Hi.
I’m trying to build a world builder and I wonder if there is an easy way to save the scene while playing, if not, is there an easy (or hard) way to make a new file format and save and read from that?
/Aron
Hi.
I’m trying to build a world builder and I wonder if there is an easy way to save the scene while playing, if not, is there an easy (or hard) way to make a new file format and save and read from that?
/Aron
You would probably use the PlayerPrefs class.
This is a wonderful little device. It is basically an INI reader/writer type class. (or on windows, registery key writer)this is fine for simple user data, but use the xmlserializer/deserializer for large amounds of data and save to a flat file, makes life simple.
Well, i can’t use the PlayerPrefs because I have to much date.
The XmlSerializer looks interesting though, can you give me a link or an example of how I can use it?
Thanks /Aron
If you’re in webplayer, your only option is to use the player prefs to load and store local data. In any case, xml wrapping or serialising your data would be a good idea if you have a lot of data. If you’re in C#, you should also check out ISerializable - the result takes up less bytes than the XML serialisation.
Actually, I think having a Web player as world builder would be pretty intense. Isn’t there a 1MB limit on the size of PlayerPrefs files?
If it really is a Web player, you’d probably have to build a (Web)server-client infrastructure, so you’d save and load to/from the net (and I agree that XML would probably be nice for that - but unless you use a custom small footprint XML API, that would bloat a Web player a bit, I guess 1 or 2 MBs extra for the assemblies that are automatically included).
No, I’m not building in a web-player, this will be a standalone app.
Although I have not worked with xml before, so I would be glad if anyone could show me some examples so I can build from that.
Thanks /Aron