Why Can I Not Apply GameObjects To Prefab?


I have a prefab of a cube that has a script that requires some Transform variables to be applied to them. Such as:

var Enter : Transform;
var Exit : Transform;

And basically, my cube moves from enter, to exit. These are game empties on my scene. Unity is not allowing me to drag these objects onto the variable slots once I turn my cube into a prefab? Why is that?

Thanks, Ollie

You have to put other prefabs in, as the prefab can't reference something from a scene.

Prefab references exist throughout the whole game lifespan, but objects in the scene only appear during the scene itself, so it doesn't make sense to be able to link them from a prefab

Drag your prefab into the scene, so it becomes an instance. Then you can drag scene objects onto the variable slots.