Programming Question

Off topic discussion. Talk about gaming and life in general. Be awesome to each other.
User avatar
Posts: 66
Joined: Thu Dec 24, 2015 12:09 am

Re: Programming Question

Post by LorrMaster42 » Fri Aug 25, 2017 2:24 am

So would it make sense for me to have a special scene for holding all the dungeon data I want to save, then?

User avatar
Posts: 5680
Joined: Sun Mar 22, 2015 1:51 am

Re: Programming Question

Post by Interkarma » Fri Aug 25, 2017 3:22 am

Try it both ways. :) Make a small test EditorWindow with some basic data and try storing data to an object (or objects) in the scene. Then try a basic JSON serialization setup. See which way you like, and what will work best for your project.

If you just want things to be as easy as possible, store your persistent data on GameObjects in the scene and make script members public. Unity will then save/load your data with the scene. Your EditorWindow is just a client tool used to modify that data. This is ideal for when your EditorWindow is intended to control some GameObject(s) in the scene.

If you want complete control, roll your own serialization with JSON and store those files in the Asset Hierarchy or elsewhere on the drive (e.g. persistent data path). This can make your EditorWindow work like a totally self-contained application that just happens to run inside Unity. This is ideal when your EditorWindow never cares about what's in the scene.

Post Reply