title: Loop movement system in pathfinding unity
body: <p>I am using the A* pathfinding algorithm taken from here <a href="http://arongranberg.com/astar/docs/" rel="nofollow">http://arongranberg.com/astar/docs/</a> and I am trying to make an object move from a random point to another random point in a loop system in unity.This is the code used to move the object: I tried to put the points into an array but it didnt work. The author says that If I want additional behaviour after the AI reached its destination I should write the code in the OnTargetReached() method, but I am not sure exactly how to. If you've got any ideas, even the smallest would be very helpful. </p>
  
  <pre><code>public virtual void SearchPath () {
      //if (target == null) 
      //{ Debug.LogError ("Target is null, aborting all search"); canSearch = false; return; }
  
      lastRepath = Time.time;
      //This is where we should search to
  
  
      //Vector3 [] position = new Vector3[2];
      //position[0] = new Vector3(Random.Range(-2,-7), 0, Random.Range(21,26));
      //position[1] = new Vector3(Random.Range(19,23), 0, Random.Range (28,31));
      //position[2] = 
      canSearchAgain = false;
  
      //Alternative way of requesting the path
      //Path p = PathPool&lt;Path&gt;.GetPath().Setup(GetFeetPosition(),targetPoint,null);
      //seeker.StartPath (p);
  
      //We should search from the current position
  
      seeker.StartPath (GetFeetPosition(),targetPosition);    
  }
  
  public virtual void OnTargetReached () {
      //End of path has been reached
      //If you want custom logic for when the AI has reached it's destination
      //add it here
      //You can also create a new script which inherits from this one
      //and override the function in that script
      //Vector3 new_targetPosition = new Vector3(Random.Range(19,23), 0, Random.Range (28,31));
      //Vector3 new_targetPosition = new Vector3(19,0,28);
      seeker.StartPath (GetFeetPosition(),new_targetPosition);
  }
  </code></pre>