- Home /
Changing prefab doesn't update instances (in scene aswell as in other prefabs)..
After making a change to a prefab, how do I update all instances of that prefab with that change? It doesn't do it automatically or prompt me with anything. I know I can reset each instance individually, but that's tedious and repetitive if there's a lot of instances.
I know this questions been asked many times before, but I still haven't found an answer. How do I reset or at least update changes of all instances of a prefab at once? By instances I mean instances in scenes as well as references from other prefabs (prefabs childed to other prefabs).
Answer by carrollh · Feb 06, 2015 at 02:01 AM
As far as I can tell, once you set a prefab as the child of another prefab it stops being an instance of the original completely. Updating will only cause the parent prefab to change. I found this link http://framebunker.com/blog/poor-mans-nested-prefabs/ in this thread http://answers.unity3d.com/questions/320934/workarounds-for-nested-prefabs.html and they pretty much say the same. The first link has a working solution, using the IBakeable interface (which I didn't know existed until now).
Yeah that just sort of clicked in my head "what if children prefabs become unreferenced and are ins$$anonymous$$d a completely new prefab?"
I was really afraid that would be the case.. :(
Thanks for the solution, I'll try it out. I was thinking I'd have to make my own editor script to find all objects of the same name as the prefab in the project and then replace them with the updated prefab.. Ugh that sounds like a bunch of issues waiting to happen.
Yeah, sounds like a headache if you don't catch it early. The poor man's nested prefabs link basically has a script you can put on a prefab manager of sorts that seems to have gotten good reviews.
Yeah its just kind of weird having to drag a script on every instance of a model and then dragging the original in the script every time i want to use a model.. The time spent navigating through folders is still a bit tedious and time consu$$anonymous$$g..
Still much better than nothing. I might try writing an editor script to somehow make it quicker to do.
I'm really surprised unity doesn't support nested prefabs already. I thought that was one of the big advantages of the prefab system.
I also found this which explains the dilemma in decent detail: https://josephstankowicz.wordpress.com/2013/05/23/the-perils-of-prefabs/
Answer by James-Blaskett · Dec 01, 2017 at 08:41 AM
Catching it early is definitely key, but once you have caught it, there's a much simpler solution. Rather than adding prefabs as children to other objects, add null objects with a spawner script attached. The script can be as simple as the below (or as complicated as you want):
public class Spawner : MonoBehaviour
{
public GameObject assignObjectInInspector;
void Start()
{
GameObject myObject = Instantiate(assignObjectInInspector, transform.position, transform.rotation);
myObject.transform.parent = gameObject.transform;
}
}
You can also put this script directly onto the parent and assign an array of spawners, whatever works best for you.
Answer by vfxjex · Sep 12, 2019 at 02:53 AM
Select your prefab then open prefab assets Drag the prefab you want to update to its prefab inside your project folder.
I don't understand the part when you say to drag the prefab to its prefab in the project folder. I tried but it doesn't work.
Your answer
Follow this Question
Related Questions
Display one of prefab child 1 Answer
Prefab not changing variable's values 2 Answers
Changing the Variables of An Instanced Script 2 Answers
Why is instantiated animator prefabs are not working properly? 2 Answers
What process should I best use to properly create an updated copy of a Prefab? 1 Answer