This is a category in which I will present all the code stuff I found working with Visual3d.net and which might be useful for others as well.
I will begin with a problem I had to solve recently: For some kind of mission system I wanted to save a list of actors with the name “Garage” to another xml file. I tried using XmlSerializer but that did not work. After asking najak I knew that Visual3d.net uses something called NDCS Serialization (search the internet for details). EDIT: One info before starting, you cannot serialize or deserialize static objects! So to serialize you first have to create the SavingFormat:
var savingFormat = new SavingFormat.NetDataContractXmlSerializerFormat();
then if we want to save an object now we have to use:
bool success = App.Library.Assets.TrySave(new SaveParams(obj, path, savingFormat), true);
and for loading:
bool success = App.Library.Assets.TryLoad(new LoadParams(path, savingFormat), out loadedObject);
This should work for the current Beta release, if you can wait until next Beta, which will come shortly, then you can use the new methods which simplify that process again:
For Saving use:
App.Library.Assets. TrySave(object dataObj, string filePath)
And for loading:
App.Library.Assets. TryLoad<T>(string filePath, out T loadedObject)
This is the proposed way of doing this. You do not need to create the SavingFormat anymore.
I hope this blog post is helpful for you, if you have any questions feel free to ask them.
-Chris
love
Recent Page Comments
2 weeks 2 days ago
2 weeks 5 days ago
7 weeks 1 day ago
10 weeks 1 day ago
12 weeks 1 day ago
14 weeks 2 days ago
15 weeks 3 days ago
20 weeks 4 days ago
30 weeks 4 days ago
33 weeks 5 days ago