0
votes

Im just starting to use the new Unity nested prefab workflow (or what ever you call it) in Unity 2018.3

So how it works is when you want to edit a prefab, you select it then click on the arrow. When you do this it erases everything from the hierarchy window and then you only have that prefab visible until your done editing it, you click save and then its back to the original hierarchy that was there before you started editing.

This is all fine, but the problem is what if i want to drag a game object from my scene into the prefab im editing is now impossible because as soon as you start editing the prefab, it removes your scene and only shows the contents of the prefab. So you cant drag anything from your scene into the prefab any more because its gone for the duration of the editing.

I dont know if im making myself clear or not.... But basically im saying while editing the prefab, only the contents of the prefab is visible, your scene is not visible, so you cant drag any object from your scene into the prefab anymore.

Anybody knows how to get around this? Right now i want to drag a gameObject from my scene into a prefab im editing to make a reference to a global object, but while editing the prefab my scene is not visible, so i cant do it.

Thank

2
You can not use objects from the scene as they live in the scene and if you put a object from the scene into a prefab the engine can't guarantee that that object from the scene will exist next time you use the prefab. Basicly you can't put objects from the scene because they don't exist (they only exist in the scene)Milos Romanic
You can simply drag and drop objects into the prefab the same way as before: Drag the Prefab into the scene, make all changes -> Apply Overwrites. The only thing you can not do is dragging a new object inbetween the prefab but only add it to the root prefab as last child. Then after hitting Overwrites -> apply you can go into the Prefab edit mode and arrange the newly added object further.derHugo

2 Answers

0
votes

Just create a copy of your prefab in Hierarchy and make you required changes to that copy once done, drag and drop that copy on you prefab and it will be updated.

When dropping the copy on your prefab you can either create a new prefab or update the original one.

0
votes

Editing a prefab can be done in multiple ways. To achieve what you want, you should drag an instance of the prefab into your scene where your "other" gameobject is. Ensure that the prefab instance is blue, so that you know that it is still connected to the prefab.

Now, drag your "other" gameobject onto the prefab instance, so that it becomes a child of it. Now you should be able to apply prefab changes through the inspector.

enter image description here

Do note, if you cannot change the position in the hierarchy of the "other" gameobject onto a prefab from within the scene view. If you want to change the position, you should open the prefab scene after applying changes.