- Home /
 
               Question by 
               DKaras · Apr 10, 2021 at 05:47 PM · 
                gameobjectprefabprefabsgameobjectsprefab changing at runtime  
              
 
              Reinitialize prefab
Let's say that during the runtime, I have some gameobject that I want to reset to the state of its coresponding prefab (for example - to re-enable all colliders, unparent all other gameobjects that weren't there at the start etc.),
The typical approach would be to destroy said gameobject with GameObject.Destroy(gameobject) and then recreating it with GameObject.Instantiate(prefab).
The problem with this approach is the fact, that reference to said gameobject may be held by other objects or may exist in Zenject's context.
Is there any straightforward way to do this or do I need to write some custom script that reverts all the unneeded changes?
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
               
 
			 
                