2d pathfinding not seeking current prefab of target

Si I have this scene, I have a target prefab and an enemy prefab. If i drag them into the scene, the enemy prefab does not seek the target prefab, it seeks empty space where the prefab WAS before i turned it into a prefab.

It is as if it stored the original path and is not recalculating now.

Is there a way to force it to update ? Because im using prefabs do I need some sort of script to let the enemy know what to seek even though it has the prefab in its seek target ? (note that if i put the prefabs in the scene then drag the toilet paper prefab into the target of the enemy, it works as expected … but it should auto update on awake shouldnt it ?)

You can see in the attached image where it’s seeking to (vs seeking to the stack of toilet paper on the right)

So… still waiting to see if someone can help.

I’ve now started instantiating the enemies through a spawn script, now they seem to just be trying to pathfind to 0,0 rather than to the target of the destination setter (that is already present in the scene).

So related to the original issue, how do I tell the destination setter what to target when the prefab is instantiated.

I’m not a coder, so the docs aren’t super helpful to me, but I assume there’s a reasonably easy way to choose a target based on a tag or something ?

Hi

If you reference a prefab it will always continue to reference the prefab. If you want to reference an object in the scene you will have to set that reference when you instantiate the object (using a script for example).

Ok. How would I go about doing that ? Is there some easy way of saying 'when i exist target ’ … could you point me at the right… method, or whatever in the documentation. (note im using the current appstore version not the beta because im in 2019.2)

Something like

void Start () {
    GetComponent<AIDestinationSetter>().target = GameObject.FindWithTag("mytag").transform;
}

cheers, doing it with a tag definitely suits how Im setting up the scene.

None of the demos do this kind of behavior do they ?

No. None of the demos do this.