NavMesh Agent pause?

Hello there I was wondering what would be the best aproch to pause a navmesh agents movent towards a target.

this is what im using, I am animating a from and would like it to hop from one area to another on its own. I have it going there with a hop animation, but its linial movement, so even when stopped (animation), the object is moving and looks bad of course.

I am using this code:

GetComponent(NavMeshAgent).destination = target.position;

Just need so pause the movement about half a second or even 1…
I have tried co-routines and timers, but the agent seems to override them all…

Many thanks in advance!


To pause the agent use NavMeshAgent's Stop() method. You can use the boolean to essentially stop abruptly (true) or smoothly with avoidance (false-the default).

To resume use Resume() and the agent continues to the current destination as you’d expect.

By the way, the above approach seems to be a valid alternative, though it might use a tad more cpu.

I’ve finally found a solution to pause and resume an agent instantly :

void pause() {
    	lastAgentVelocity = agent.velocity;
    	lastAgentPath = agent.path;
    	agent.velocity =;
    void resume() {
    	agent.velocity = lastAgentVelocity;

Bear in mind it could be slightly buggy i’ve never coded in javascript just inferred by reading it on this site the language syntax.

function wait(targetPos : vector3){

GetComponent(NavMeshAgent).destination = GameObject.transform.position;
yield WaitForSeconds(1);
GetComponent(NavMeshAgent).destination = target.position;

mark as answered :slight_smile: