I have a somewhat peculiar issue going on. I have a GameManager object in the first scene of my game with a DontDestroyOnLoad() attached to the script. I understand the gameObject with the script attached to it will not get destroyed between scenes but does that include data held in the GameManager script?
I have 4 scenes in the game. The GameManager object is in scene 1 where I do some setup operations for the game, scene 2 is the main menu, scene 3 is the level select menu and scene 4 is where an instance of the actual game is randomly generated(I seed the random number generator to have control of over how the generated scenes look). I have 30 buttons in the level select menu representing 30 levels. There is a Level script attached to all of the buttons with an integer variable that I pass to the GameManager object when any of the button is pressed to seed the random number generator to give the illusion of a new level. I can pass that integer variable to the GameManager script which in turn seeds the random number generator but I cannot pass a regular gameObject or script to the GameManager the same way I did for the random number generator seed. I just need a reference to the Level script in the button so when a level is complete the script in turn activates the next Button(next level). I don’t know if this is the most efficient way to do it but the Level script I pass to the GameManager gets destroyed every time the game scene loads. (I used an if statement and Debug.Log() to verify before I use it). Can anybody shed some light on this for me?