I have a randomly generated terrain and a functional Save/Load system using XML. In order to save the generated terrain, I tried serializing the heights in XML but it gives me an error (2d arrays aren't accepted as primitives). This is basically what I did :
And then the data is serialized.
I tried serializing other types like int, string or even Array() and it works, so it's not the Saving system that causes the problem.
Are there any other methods to save this type of data? Would exporting the heightmap on the hard drive and importing it when loading the game work? If so, how can I export the heightmap from script?
For reference, this is the Save/Load code I'm using : http://www.unifycommunity.com/wiki/index.php?title=Save_and_Load_from_XML
Thanks for any answers.
asked Jun 19 '10 at 05:27 PM
You could use .NET's built-in serialization.
Basically, save your data using BinaryFormatter.
answered Jun 19 '10 at 11:15 PM