#Referencing a prefab

1 messages · Page 1 of 1 (latest)

nova basin
#

What does that mean?

#

I just found something online about using the file path for the reference, so I'll use that

median root
#

If that's using AssetDatabase, that's editor-only.

nova basin
#

what exactly does that mean?

median root
#

Which part are you failing to understand

nova basin
#

"editor only"

median root
#

You will not be able to build the game if you use the AssetDatabase in runtime code

nova basin
#

oh

#

that's not good

#

what should I do instead?

#

addressables

median root
#

I have no idea why you want to reference things by path

nova basin
#

I can't seem to reference them with GameObject.Find or with FindWithTag

median root
#

Because they are not in the scene

#

Assets need to be referenced into the scene via a direct reference, or via an asset bundle, which Addressables would handle for you

#

the simplest way is to just drag and drop the prefab into a serialized reference

nova basin
median root
#

I don't know what you mean by that

#

You can reference a prefab into an object in your scene, and pass that reference to whatever other objects need it

nova basin
#

oh I see

#

Oh my gosh that's insanely smart