- Home /
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
Answer by Ebil · Jan 14, 2013 at 12:13 PM
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...
Thanks $$anonymous$$. However, i have around 45 levels ( each level is a scene so far ) Could you please point me out a link for the 'Netzwork tutorials' to save a level ?
Your answer
Follow this Question
Related Questions
Object Not Centering/Reseting Properly with Grid 0 Answers
Moving GameObject to various position ? 1 Answer
[Solved] How to get non repeating random positions? 5 Answers
The Script keeps executing..instead executing onec 0 Answers
Object's sprite and collider are not at same position as transform 1 Answer