![]() ![]() Scene Only, Pleaseīut what if you need to have shared data in the scene? You might not want to create assets for each data in each of the scene, as this makes the asset database cluttered with data only relevant to a certain scene. I usually have a GameDatabase asset which contains the global configurable parameters for the game. This data can be anything like lists of enemy prefab names, in-game shop configuration, list of chapters and levels in the game and their respective scene names etc. For example if you need team colors (red and blue) instead of sprinkling the colors to every possible component you can just have a reference to a TeamColor ScriptableObject and keep the color there – the same way you do with PhysicsMaterial for example. ![]() You can then reference this data from the components in the scene, and they all will share same values. A neat solution for persistent, config-kind-of-data is to put it in a custom ScriptableObject that then is saved to the asset database. (They really should do a blog post / tutorial / documentation about how to store your data, like a flow chart to decide where to put your data □ ) Common Data, Common ProblemĬommon problem is where to put data that you need to share between components. I’m not going to in the details - you should read the great blog post at Unit圓d.com about the serialization here. ![]() When you start developing with Unity, one of the basic thing you need to get your head around is the way Unity handles classes and data for your game. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |