Hello I want to clear the destination so the agent doesnt try to walk there.
If I use _navAgent.Move it will later try to go back to the previous set destination. How can I clear this?
_navAgent.SetDestination(null);
Hello I want to clear the destination so the agent doesnt try to walk there.
If I use _navAgent.Move it will later try to go back to the previous set destination. How can I clear this?
_navAgent.SetDestination(null);
I think you’re looking for SetPath(null). Setting this to null removes the path, but you’ll also have to make sure it doesn’t recalculate another path. Here’s a link to the docs on this method.
You can also SetDestination(transform.position) if you want.
This will also leave a Destination setted and later on it will auto calculate the path again, I just want to remove it.
SetPath has the same problem it will just avoid the path for some time until it recalculates, can’t I jsut set destination to a value that will not calculate anything?
Hi
You can do
ai.destination = Vector3.infinity
That will make it treat it as unset. This is the value it has when the game starts.