The main menu has a ‘new game’ button which loads the game scene.
So the game opens up, you press new game and you play the game until the game ends (game over), then the menu screen gets loaded. The problem i have is that NOW, when you press the new game button, the game gets loaded from the game over section, rather than the entire scene being restarted.
And all the other ‘restarting’ scene google searches.
How do i actually restart a scene, instead of just loading it, like all the threads show?
I want the scene to reload to its start position, that is, the scene when it is first loaded, having the same result as destroying the scene and starting the scene again.
¨There’s three ways off the top of my head:
1: reset all the static variables when you restart. This is a bit complicated if they’re all over the place.
2: Move all the static variables to a singleton object that’s still globally accessible. Then you can just dump the entire singleton (instance = new Singleton()) when you restart.
3: Stop using static variables in that way.