#transform type mismatch on a prefab when dragging an object from hierarchy

1 messages · Page 1 of 1 (latest)

leaden granite
#

Well... yeah

round mesa
#

whats the reason?

leaden granite
#

How do you expect to assign a scene entity in a prefab?

round mesa
#

dragging it on a prefab, since the object is always in the scene?

leaden granite
#

The prefab isn't though..

round mesa
#

im a noob if you havent noticed so idk

#

so how do i make it get the players current location then?

leaden granite
#

Inject a reference when you instantiate it

round mesa
#

uhh

#

yea, ima need to do some google searches

#

wait, but i have a spawnManager script that instantiates enemies, but im making it track from the enemy script

#

how would injecting a reference work

leaden granite
#

im making it track from the enemy script
What do you mean by this

round mesa
#

i have an enemy script, which im making the enemy chase after the player and also attack and stuff, but i instantiate the enemy from a spawnManager script

leaden granite
#

I assume the spawn manager is present in the scene, yes? (Not a prefab itself)

round mesa
#

yes, its in the scene

leaden granite
#

Have the spawn manager track the player reference (use a serialized field), you can drag the player onto the spawn manager.

The spawn manager then just passes that reference on after Instantiate-ing an enemy

#

Ideally using a property

round mesa
#

alright ima give it a try

#

thanks