V
V
Vlad667766772021-10-01 16:48:32
Unity
Vlad66776677, 2021-10-01 16:48:32

How to add an object from the hierarchy to the prefab script?

I have a prefab and it has a code and in the code there is a GameObject. How to add an object from the hierarchy to the GameObject in the script (which is located on the prefab). Unity just blocks and does not let you cast.615711280c07f865569199.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GavriKos, 2021-10-01
@GavriKos

And block correctly. You cannot add scene objects to prefabs that are not on the stage. Change the approach, or add a prefab to the stage - but then other instances will not have this object

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question