- Home /
How to restart level properly to avoid issues with instantiation?
First, I have as an example some crates in my game that instantiate broken parts when they are destroyed.
Then, when I use something like SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); to restart my level, the level restarts with new crates being created and the old ones destroyed, which results in hundreds of objects all being created and destroyed at once and on top of each other.
I just assumed something like restarting the level would automatically remove absolutely everything in the scene and start from fresh as though it were loaded for the very first time, but that's obviously not how it's working.
So, how do I restart a level properly to avoid this kind of thing?
And, if this is more an issue with how I'm destroying the crates and instantiating the broken parts, how would I do this without using the Destroy(); command for the crates when they are broken by the player (if that's what's causing the issue)?
Your answer
![](https://koobas.hobune.stream/wayback/20220612172532im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Reset prefab instead of destroying and instantiating again 1 Answer
restart everything on level 1 load 1 Answer
Value sometimes isn't updated. 1 Answer
1 Scene game|| Reset variables 1 Answer
Resetting a Scene 2 Answers