0 votes
by (8.2k points)
edited by

How do make changes in all game objects created from the same prefabs?

When spawning a new clone of a prefab that I created I want the instantiated game objects to move to the position that another game object.

I have made two prefabs of my enemies for my 3D game: normal and damaged. 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

1 Answer

0 votes
by (8.2k points)

 There are two methods for doing this.

  1. One is to edit the property in the prefab itself in the project window. This should propagate the changes to all prefabs that have not been overridden.

  2. The other method is to change the property in a single prefab. If you don't "apply" changes, that property will be considered "unique" and will override changes to the prefab. The title of the property will become bold.

If you "apply" the changes, that property will no longer be considered unique and all of the changes will be propagated to all prefabs except for properties that have been over-ridden in any given prefab.

You can "apply" the changes by clicking the "apply" button next to the word Prefab near the top of the Inspector.

Also, this doesn't apply to Transforms. So when you click Apply, all the transform values will go bold (meaning they're custom values now, different from the prefab,) even as the other components of your prefab all stop being bold (indicating that they now match the prefab and will inherit changes from it)

TechXR runs courses in AR / VR / Metaverse / Game Development. Some of the popular Q&A in our courses are available here for easy discovery.

113 questions

117 answers

54 comments

105k users

...