I have a script on an empty game object which contains my global variables.
I want this script to stay intact through all scenes so I write…
function Start()
{
globalVars = GetComponent(GlobalFunctionsScript);
DontDestroyOnLoad (globalVars);
}
The problem is that when I returen to the scne where the empty game object originally exists I notice in the inspector there are now 2. If I continue to leave and re-enter the scene the game object containing my global variables is duplicated…again and again…
Should I care? Is this just an ‘editor’ thing? AFter all, the game is always using the first one that I ‘didnt destroy’.
Is there a better way to store my global vars or is this the generally used method?
Cheers