Skip to main content
edited title
Link
House
  • 73.3k
  • 17
  • 185
  • 273

Question about applying Changing one prefab changes to prefabs in Unityall other instances of that prefab too

Source Link
bukka.wh
  • 259
  • 4
  • 6
  • 17

Question about applying changes to prefabs in Unity

I have made two prefabs of my enemies for my 2D game: normal and damaged. The I put several of these prefabs on scene. When enemies health <=0 I need to destroy its GameObject and then instantiate a damaged prefab on its position. But when I am doing this, all other prefabs are destroying too and damaged prefabs are instantiated on their positions. After searching this site I found out that any changes with one prefab are applying to all other prefabs on scene? Is this right?

P.S. I have edited the script where I am destroying prefab and added to it a simple check, if the prefabs renderer is visible on scene, then I need to destroy it, because all other prefabs are not visible at this moment. Do I need to check to make sure that this is the instance of the prefab is that I need every time when I want to apply to it some change?