Reset GameObject positions

Hello,

I was wondering what was the best way to reset GameObject positions to their initial loading state.
basically, When my hero die, the user has the possibility to restart the level. For the moment, i reload the scene, it takes ages ( around 2 secs ).

To make it faster, i was thinking to reset all my gameobject to their initial positions without reloading the scene

Few questions though :

  • how to know if a gameobject has moved when the hero dies ?

    => I was thinking to store all the gameobjects in a list on Awake() then compare their new positions when the heroes dies. However, Do i need to find all my gameObjects again so i can compare initial gameobject state and new gameobjects states ? it might lag a bit to find them all again. I am pretty sure i could do something with the list where all my gameobject have been store when loading the scene.

  • How to re-instanciate some gameobject which have been destroyed?

=> Some objects ( prefab ), could have been destroyed during the game. How would you re-instanciate them when the heroe dies since they don’t exists in the scene anymore?

It would be nice if you could share your experiences with that or propose better ideas to do it.

Many Thanks

Florent

Its better you make a script to load a level which you have saved before.
Examples for that can be found in the Netzwork tutorials. So you basically just load the level again and your hero respawns…