Do persistent variables need to be in every scene?
In order to save data, do persistent variables need to be placed in all scenes, or just in the scenes where the data is needed? For example. The data needs to transfer between scene A and scene B, but is not needed in scene C. If the player then goes from A to B to C, then back to scene A, will the data be retained without the variable being placed in scene C?
-
Nope. That's a common misconception that's been unfortunately spread by some tutorials videos on youtube, but it's incorrect. You only need a persistent variable in the scenes where you need to read or change it.
-
Makes sense... thanks
Please sign in to leave a comment.