Cant See My Prefab At Assets

I MonoBehaviour class called “Building” and I attached the prefab but I can not give as parameter to my other MonoBehaviour but when I add my prefab to scene it can be seen on “Scenes” folder. How can I solve this ?

Not sure if I understood your question correctly. You have a prefab with a Building script, another script with a Building property and try to assign the prefab to this property?

This only works if you directly assign the prefab to the property, by dragging it from the project view to the script’s property. If you open the object picker, the prefab won’t show up in the Assets tab, unfortunately.

The reason is that Unity’s asset database doesn’t index components on prefabs. For the asset database, all prefabs are just game objects and it doesn’t know anything about components added to them. If you have a property of a script type and want to assign a prefab, Unity’s asset database won’t find any assets matching its type. However, if you drag the prefab onto the property, Unity will check the components and allow you to assign the prefab.

1 Like