Hi All,
Had a few questions regarding Variable Lifespan. Let’s assume I have the following:
Scene 1 - Main Menu
Scene 2 - Play Board
My questions revolve around what happens to variables during scene changes.
For example. Let’s say I click play on scene 1 and now load Scene 2. Scene 2 sets variables etc, allocates an array at the top of a script for the play board etc.
When I leave Scene 2 and go back to Scene 1 after playing, are all my variables still around, or has garbage collection removed them?
If I then click play again on Scene 1 and load scene 2, am I now allocating a second set of variables, such as an array that I load information into?
Do all the events like Awake, Start, etc all get sent again if it is the second time I am now loading Scene 2?
Is there something special I should do when leaving a scene or loading a scene to ensure I am not allocating space for the same variable twice (aka the second time into Scene 2 when I load it).
Thanks for all the help
Chris