I’m currently making a sports management game and am storing my data in gameobjects. now that I have over 100 players and therefor 100 gameobjects its getting very messy in my hierarchy. Then when I add each game played to a gameobject I’m getting a ridiculous amount of gameobjects.
Is there any other ways of storing the data more efficiently without SQL as android doesn’t let me use it? and could you point me to a tutorial on the subject if possible so I can learn more? Almost everything I can find is for saving a game not looking up data for transfers etc.
Thanks Andy
- hold accessible data on disk (stay
always after game close) : use
[playerPrefs][1] or any other method
of [serialisation] for example
[2][2].
2. hold accessible data on RAM
(gone when you close game): use
[Lists][3]/[Arrays][4]/c#
[Variables][5] etc...
you may check also : [scriptable-objects][6]
[1]: https://docs.unity3d.com/ScriptReference/PlayerPrefs.html
[2]: https://docs.unity3d.com/ScriptReference/JsonUtility.html
[3]: https://msdn.microsoft.com/en-us/library/6sh2ey19(v=vs.110).aspx
[4]: https://msdn.microsoft.com/en-us/library/aa288453(v=vs.71).aspx
[5]: https://www.tutorialspoint.com/csharp/csharp_data_types.htm
[6]: https://unity3d.com/fr/learn/tutorials/modules/beginner/live-training-archive/scriptable-objects
U can use ScriptableObjects! it’s simple and easy! u can create a List in it! and that’s it! it’s easier than XML/JSON and u can use for session saved data or persistent ones as well! with less memory allocation or size on disk! and accept all of unity classes like vector3/vector4! and even can contain functions in it!
You should certainly not have gameobjects in your hierarchy that are just storing data - that’s what scriptableobjects are for, which Unity can serialise natively.
Alternatively, if you have a lot of tabular data, and need to describe relationships between records, SQL might be the way to go (it works fine on Android). Or XML/CSV/JSON if you have slightly more modest data requirements.