- Home /
Why should I use a game object for non-physical things?
I've been researching on the standard method of having persistent data in a unity game and the consensus seems to be that you make a GameObject and call DontDestroyOnLoad() to stop it destroying when the level is changed.
It seems strange to me that a GameObject would be used for something like this. Why not just have a static class (or a singleton class not inheriting from MonoBehaviour)? What is the benefit of fighting with the gameobject system?
What "fighting" are you having to do with the "gameobject system"?
Answer by Graham-Dunnett · Dec 07, 2012 at 12:21 PM
http://docs.unity3d.com/Documentation/ScriptReference/ScriptableObject.html can be used if you don't want to use GameObjects.
Answer by CoixdeNono · Dec 07, 2012 at 11:38 AM
The gameObject is not only made for physical things, you can use an empty GameObject to keep scripts (especially from one scene to another) or for scripts about game controle (scores) that needs to be kept, while you're destroy the actual physical GameObject in game .
Your answer
Follow this Question
Related Questions
Don't render GameObject on load if already hit by player? 1 Answer
Static List< GameObject> in Singleton 1 Answer
Attaching GameObject and ParticleSystem to C# script 1 Answer
What do the "active" and "static" checkboxes do? 1 Answer
Using static properties that return _instance.variable... 0 Answers