I'm rather new to Unity, and C# too as a matter of fact!
What I am doing right now is:
- I have a "Singleton" (it's not really a Singleton but that's not the point)
GameObject
calledGameManager
, to which is attached myGameManager.cs
script containing most of the game info (which tutorial text has been already displayed, functions to load localized text, last scene loaded...) - As children of this
GameManager
object, I have different kinds of GameObjects I do not want to destroy on load either, such as PostProcessing Profiles, Global Lights, Audio Manager, UI Canvasses (canvi?) and other things...
There are plenty of great tutorials on Unity, and it's an awesome community, but I could not really find any info on Unity's "best practice" regarding GameObjects management.
Is this a correct way to proceed? Will I have issues in the future with this method? Should I make a generic class that implements Unity's DontDestroyOnLoad()
and have the Object I want to keep inherit from that class? Is there a better way?
It works fine for now, but I want to be sure I am not doing this the wrong way and potentially messing up with my game's performance or stability.
Many thanks in advance.