- Home /
How to reload a scene to it's original state?
When I reload the scene using:
SceneManager.LoadScene("Level");
It reloads the scene, but not everything. The objects in my object pooler stay were they are and some of the value do not reset to it's starting value.
Is there a way to reload the scene like you just hit play again?
I did already try loading an other scene in-between and loading the this scene after but this doesn't make any difference.
The only reason it would keep information is static variables and using DontDestroyOnLoad. To be honest, you should only use DontDestroyOnLoad is rare cases, it's not always the best option and often times just creates more issues and creates reliance that doesn't always work if something isn't re-initialized.
Reloading doesn't reset the static variables in the scene. To solve that you should initalise all static variables in a Start() methode. The Start() methode get's called every time you loard/reloard a scene, so by initalising static variables within it, they get re-initialised as well when the scene gets reloarded.
Your answer
Follow this Question
Related Questions
GameManager and scene design issue. 1 Answer
Problem with Application.Loadedlevel 0 Answers
MissingReference When Reloading Scene 1 Answer
Application.LoadLevel & Time.timeScale glitch 1 Answer
Reset a scene 2 Answers