- Home /
AI PathState
Hi folks, I'm trying to detect when my AI guy can't reach his destination. To do so, I'm using this code:
IEnumerator ReRouteAI( )
{
agent.SetDestination (goal.transform.position);
agent.Resume ();
// Wait to generate path
while (agent.pathPending) {
Debug.LogWarning ("Waiting for Path");
yield return null;
}
Debug.LogWarning ("Path calculated");
Debug.LogWarning (" PathState: " + agent.pathStatus);
}
The issue I'm facing, is even when the path is obviously not complete (ie the AI has moved as close to the destination as he can and stops ) its reporting agent.pathstatus is always pathcomplete (I was expecting pathpartial. He's drawing a debug line to his target, so I know the his destination isn't being affected.
Any ideas as to why this is happening? Many Thanks
Your answer
![](https://koobas.hobune.stream/wayback/20220612112936im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Trouble with Navmesh Agent and Navmesh Obstacle 0 Answers
Is there a limit on how far a navmesh agent can go? 0 Answers
Trouble with 2 Navmesh Agents going in circles, but should find eachother 0 Answers
Unity Pathfinding One Way 0 Answers
NavMeshAgent calculated path going in a straight line ignoring height in between start and end 1 Answer