I seem to be encountering an issue with my prefabs. I created a Small Prefab, which works fine. Then I created a Parent Prefab which has 9 Small Prefabs as children. Now, if I update the Small Prefab by itself, the Small Prefabs that are children under the Parent Prefab do not update.
Can anyone explain this behavior? Are children to a prefab, even if they’re prefabs themselves, no longer connected to their original?
If this is the case, how can I create a prefab that has other prefabs as children?
hi,
one time you created a prefab and dragged it to the scene or hierarchy panel, after any change you do on your prefab, you must to click in “Apply” button located on the inspector panel, that will update your prefab…
Can anyone offer any advice? Specifically about how the child-prefabs could potentially work? It seems that once a prefab becomes a child of another prefab, it’s no longer considered a prefab itself. I’ve searched in vain for an answer otherwise, but I thought this was actually a function of Unity. Is no one using prefabs in groups with dependencies between them?
I made prefabs wth children that were also prefabs without even thinking about it (I just assumed the child would always just refer to the prefab that represents it).
This is how I’d do it (might need a little adjusting):
class PrefabWithChildren extends MonoBehaviour {
var children : GameObject[];
function Awake() {
for ( var go : GameObject in children ) {
var newKid : GameObject = Instantiate( go, transform.position, Quaternion.identity );
newKid.transform.parent = transform;
}
}
}
Thanks for the speedy reply, and sorry for my late response :[
I ended up doing something different but similar; essentially ditching the prefab-inside-prefab structure and instead just adding the children through a script.
Just to add a little note to that, nested prefabs, that is prefab-inside-prefab, is not supported in Unity yet. They did demo nested prefabs at Unite this year, so it is on it’s way, but not there yet.