I have a _main gameObject with a script that’s called when a button is pressed. Basically a menu - when that happens I load the next scene with Application.LoadLevel(“myScene”);
Now in the new scene - how to retrieve my menu choice? I stuck a getter in the script of the _main game object - just unsure how to call it.
Thanks
Application.DontDestroyOnLoad may help you.
Thanks StarManta, that seems like it would do the trick. What I did instead though was create a singleton class and attach that to an empty game object in my initial scene. On scene change the singleton seems to persist just fine, as I can call a getter on it from the next scene.
However I think I like keeping a game object persisting instead - just seems more inline with how things work in Unity.
Is there a preferred method?
If the thing needs to persist, then it needs to persist. If not, then any method works.