- Home /
Saving for a Level Editor
I have built a level editor, most things like creating objects, and click and drag work quite well, there's only one issue. When I want to make a level, really I'm just using the same base and instantiating new objects over it. I'd like to instead of just storing the variables over and over again to be pulled and loaded.
Instead I want to be able to push a button and actually create a new scene and then populate that. Is such a thing possible?
Is this at all more efficient then using playerprefs or saving a Hashtable through DoNotDestroyOnLoad?
Answer by john-essy · Jul 13, 2012 at 07:58 PM
Now i am not too sure if this is possible but here is my brain pickings.
When you create your level why not save all the data to XML or something with a name then you can load all data from the XML file to populate your empty scene. Everytime you laod that scene make it soi that it is empty by default so that you can create another level and just save that one to XML. This way you can save and load what you like. The thing is i dont know if you can save all of unity's types to XML so you'll have to look into that
Thanks for your answer but I found another way. I am saving all my information to a 2d array, and using a modified PlayerPref to save that. Then just reading through the necessary part of the array when I open a level. As to why not use X$$anonymous$$L...well I just don't know X$$anonymous$$L and while I have no doubt that I'll have to learn it at some point, I just didn't feel like tackling it at the time.