title: How can I pause an navmesh agent moving in between waypoints and then continue?
body: <pre><code>using System.Collections;
  using System.Collections.Generic;
  using System.Linq;
  using UnityEngine;
  using UnityEngine.AI;
  
  public class NavigateAgent : MonoBehaviour
  {
      public List&lt;Transform&gt; points = new List&lt;Transform&gt;();
      public List&lt;GameObject&gt; npcs;
      public NavMeshAgent agent;
  
      private int destPoint = 0;
  
  
      void Start()
      {
          var wayPoints = GameObject.FindGameObjectsWithTag("Waypoint");
          foreach (GameObject waypoint in wayPoints)
          {
              points.Add(waypoint.transform);
          }
  
          npcs = GameObject.FindGameObjectsWithTag("Npc").ToList();
  
          //agent = GetComponent&lt;NavMeshAgent&gt;();
  
          // Disabling auto-braking allows for continuous movement
          // between points (ie, the agent doesn't slow down as it
          // approaches a destination point).
          agent.autoBraking = false;
  
          GotoNextPoint();
      }
  
  
      void GotoNextPoint()
      {
          // Returns if no points have been set up
          if (points.Count == 0)
              return;
  
          // Set the agent to go to the currently selected destination.
          agent.destination = points[destPoint].position;
  
          // Choose the next point in the array as the destination,
          // cycling to the start if necessary.
          destPoint = (destPoint + 1) % points.Count;
      }
  
      void VisitNpcs()
      {
          var npc = npcs[Random.Range(0, npcs.Count)];
          var distance = Vector3.Distance(npc.transform.position, agent.transform.position);
  
          if (distance &lt; 3f)
          {
              // Stop slowly agent.
              // Rotate agent and the npc at the same time slowly smooth to face each other.
          }
      }
  
      void Update()
      {
          // Choose the next destination point when the agent gets
          // close to the current one.
          if (!agent.pathPending &amp;&amp; agent.remainingDistance &lt; 0.5f)
              GotoNextPoint();
      }
  }
  </code></pre>
  
  <p>If the agent while moving between the waypoints is distance smaller then 3 from one of the random picked npcs slowly stop the agent but fast enough not to pass the npc distance smaller then 3 then both npc and agent should rotate smooth facing each other.</p>
  
  <p>After rotation part is over and they are facing each other do something.
  After this "Do Something" part is over make the agent rotating smooth back facing to where it was and then move him again to continue moving the waypoints. I want to stop him and rotate....but it's more like pause him the agent rotate do stuff and then continue moving between the waypoints.</p>
  
  <p>Each time the agent visit npc call it a pause of the agent. The logic is to pause the agent and continue.</p>