Set up click to move

Please explain this very slowly since I am very new to unity.

This is in a 2D game. I have the pathfinding script on an empty gameobject and the graph setup. Everything there is perfect. I have the Seeker, AIPath, and Funnel script on my player.

Now I can move if my target is a transform, but not if it is a position (Vector3) mostly because every time I try to setup an update function in the AIPath script, the player stops moving for some reason.

My basic function was this (I had this in the AIPath script):

void Update{
if(Input.GetMouseButtonDown(0)){
target = Camera.main.ScreenToWorldPoint(Input.mouseposition);
}
}

I don’t know exactly how pathfinding works so please explain slowly.

Thank you for any help.

Hi

You are trying to set a Transform to a Vector3 coordinate.
One way you can solve this is to create a single Target object for each agent and then instead of setting the target itself, you simply set the position of the target.

ai.target.position = blah;

Alternatively you can download the beta in which you can set a coordinate value directly without having a separate target transform.

ai.destination = blah;