- Home /
Custom level editor, looking into architecture and saving/loading methods
Hello community!
I am creating a 2D, isometric cat/mouse game for mobile and I am creating a level editor for the rest of my team to use. This editor will not be available to the public, just the dev team. I've considered purchasing level editors from the asset store but the ones available just aren't a fit for what this game requires. I have done a lot of research into making level editors but I have two questions essentially.
Should I have the level editor in a separate project Unity project, or should it function within the game itself as its own playable scene? Or even as a plugin? I'm more concerned about the architecture and what might be the best option to go for.
I am looking into different saving/loading methods. I have seen some people talk about XML file conversion, or maybe should I simply save the levels as Unity Scenes? LoadAdditive() looks promising, but still not sure about. I am unsure of what level saving method may be the best, so any ideas you have would be appreciated.
Thank you!
Answer by Cherno · Mar 29, 2016 at 11:17 AM
(This question might be better suited in the forums)
If you want users to create levels, don't save as Unity scenes since it can't be done at runtime outside of the editor environment. Hence, write a runtime edtitor. Save to file via BinaryFormatter, it doesn'T matter what file format, XML is fine as well as any kind of custom class you serialize.
As for the general environment, I'd take inspiration from existing solutions. My editor has a bar on top of the screen with various buttons that control brush size, snapping, grid size etc. Then, on the left side, I have a scroll area in place that can display various scroll windows: One for terrain editing, one for object editing, one for general map parameters, and so on. The terrain window would have buttons and input fields for the texture used for the selected tile, rotation, and everything else that's important for a terrain tile.
Other special windows can open and close under certain circumstances, like a window that displays all available tile textures.
My editor is selectable as a buiötin feature via the game's main menu; it helps with keeping everything compatible when it comes to classes and data structure. If you have two different projects, you constantly have to worry about all classes having the same classes.
If you are looking into writing your own save and load feature, take a look at my free SerializeHelper:
SerializeHelper - Free save and load utility. (De)Serialize all objects in your scene.
So I checked out your Serializer and it is exactly what I need. Thank you very much for this!
Your answer
Follow this Question
Related Questions
User Created Levels, for others to play 1 Answer
internal persistentDataPath with WRITE_EXTERNAL_STORAGE permission 4 Answers
Editor: How to save changes to a ScriptableObject loaded from Resources? 1 Answer
Binary writer not saving game data on iOS builds 1 Answer
How to make a editable text list using external text file 1 Answer