/** Force recalculation of the current path.
* If there is an ongoing path calculation, it will be canceled (so make sure you leave time for the paths to get calculated before calling this function again).
*/
public virtual void UpdatePath()
{
canSearchPath = true;
waitingForPathCalc = false;
Path p = seeker.GetCurrentPath();
//Cancel any eventual pending pathfinding request
if (p != null && !seeker.IsDone())
{
p.Error();
// Make sure it is recycled. We won't receive a callback for this one since we
// replace the path directly after this
p.Claim(this);
p.Release(this);
}
waitingForPathCalc = true;
lastRepath = Time.time;
if (target != null)
{
seeker.StartPath(tr.position, target.position);
}
// seeker.StartPath(tr.position, targetPosition);
}