Hi
when I’m sending command to move for a lot of units
I’ve noticed that
public virtual void SetPath(Vector3 destination)
{
ai.destination = destination;
ai.SearchPath();
}
works much faster than :
public virtual void SetPath(Vector3 destination)
{
PathCurrent = ABPath.Construct(AI.position, destination, OnPathComliteSetEndPoint);
AstarPath.StartPath(PathCurrent);
PathCurrent.BlockUntilCalculated();
}
public virtual void OnPathComliteSetEndPoint(Path p)
{
if (p.error)
{
Debug.LogWarning("ABPath p.error - " + p.errorLog);
}
else
{
Seeker.PostProcess(p);
AI.destination = p.vectorPath.GetLast();
AI.SetPath(p);
}
}
- why?
- is it a way to add some performance to ABPath.Construct variation?