So I’m trying my hand at making a small level editor on the iPhone. I want the player to be able to load a blank level, place a few items then save it for later use.
It would also be awesome to share the levels with other players but that’s just a possibility right now.
This is not a “how to” question, I’ve done my own google searching for that and I’ve found plenty of info, my question is what do people more experienced than me suggest? I’m still pretty new to this and it’d be nice to hear some suggestions.
I’ve read that saving to PlayerPrefs works well, my only problem with this is that it eliminates the ability to share the levels with other people. I’ve also heard that saving to an XML document could work. This will, of course, mean I’ll have to learn how to use XML documents but I’m not opposed to learning something new.
So, any suggestions, favorite methods, things to stay away from, words from the wise?
Thanks.
XML is extremely easy to figure out, i use it all the time in self apps that i make just for myself. I would recomend that, but im sure that everyone finds there own good ways to do things.
PlayerPrefs is not suitable for this. It’s all in the name - you’re not saving a “player preference”!
XML is a pretty decent general purpose format for the job if you don’t feel like rolling your own. Of course that only handles the parsing and syntax half of the issue, what data to save, how to get it, and how to interpret it and use it as you read it back in are still up to you. .NET/Mono has plenty of XML support built in, though, so you may as well make use of it.
Past that, file IO is your friend. (Indeed, considering the number of people abusing PlayerPrefs, it might be worth updating the documentation to suggest alternatives for people who are new to that kind of thing.) There’s file storage space available to apps on iOS which can be accessed using file IO as is available through Unity’s Mono framework, so finding a few tutes about how to save and load text files (there’s plenty around) should get you going.