Noob question about best practice in managing game data

Hi, I’m new to Unity, and I’m planning to make a game that contains a lot of characters with lots of information on each. So, I would like to know what is the best practice to manage the characters data? Should I turn each of them into specific objects and take them scene to scne with the DontDestroyOnLoad method? Should I keep a single object with all the characters’ data in the game and use it to instantiate a prefab when a need them? Should I keep saving the data in the hard drive and load it in the generic prefab of personages when I need them? Or some other technique?

I’m not sure, because I see problems in all the technique I’ve listed above.

  1. The first one seems to me to not represent the idea of game model in Unity
  2. The second seems to not represent the basic idea of ​​the technique of object orientation, which says that each object must take care of itself.
  3. The third one seems to me that it would make a bad optimized game. And moreover it would make my life very difficult, because in some moments of the code I would need to compare data of all the characters at the same time.

Anyway, does anyone have a suggestion?

Im pretty sure you can make a preload scene, and store all your information there.
Check this out and see if it is what you are looking for: c# - Unity game manager. Script works only one time - Stack Overflow

@ImpMontezuma None of the above! Infact the best way I found is to simply store them in folders inside your assets. “But wiat! How can that be? You can’t access your assets IN GAME!!” ~ But thats where you are wrong! Simply pop them into the Resource folder and Bobs your aunt (can’t assume gender these days)! All you need to do is Resources.Load<GameObject> ("My Path") or Resources.LoadAll<GameObject>("My Path") and you can have it accessible from any script. BOOM - Link to doco!


But now you must be thinking: “FOOL, the property data of the characters change and needs to be retianed between sessions!” Well fear not! Your C#/Unity mastery is but a few lines of code away - Introducing… JSON.


In-fact, JSON is so good to use the Unity Peeps made a step by step tutorial on how to do it RIIIIIIIIIIGHT here.


May the odds be ever in your favor.