FYI I was getting warnings like this: Path Failed : Computation Time 0.00 ms Searched Nodes 0
Turns out it was because SetDestination was being called to quickly.
I had to make 2 changes to the MoveTo task:
- Remove the call to SetDestination in Start()
- Modify the underlying SetDestination method to check if a path was pending
At one point I was getting so many warnings that it was actually breaking the pathing of my AI.
Link to thread on astar forums: https://forum.arongranberg.com/t/path-failed-computation-time-0-00-ms-searched-nodes-0/13499
Main point of interest from Aron:
Turns out it was because SetDestination was being called to quickly.
I had to make 2 changes to the MoveTo task:
- Remove the call to SetDestination in Start()
- Modify the underlying SetDestination method to check if a path was pending
protected override bool SetDestination(Vector3 target)
{
if (agent.pathPending) return true;
agent.canSearch = true;
agent.canMove = true;
agent.destination = target;
agent.SearchPath();
return true;
}
At one point I was getting so many warnings that it was actually breaking the pathing of my AI.
Link to thread on astar forums: https://forum.arongranberg.com/t/path-failed-computation-time-0-00-ms-searched-nodes-0/13499
Main point of interest from Aron:
This is most likely because you are calling ai.SearchPath() faster than the agent can calculate its path. If a path request is pending when ai.SearchPath is called, then the previous path request will be aborted. You can check if a path is pending using ai.pathPending.