- Home /
Why Can I Not Apply GameObjects To Prefab?
Hello,
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
Answer by Mike 3 · Dec 11, 2010 at 07:06 PM
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
Answer by Eric5h5 · Dec 11, 2010 at 07:17 PM
Drag your prefab into the scene, so it becomes an instance. Then you can drag scene objects onto the variable slots.