NavMesh Pathfinding Issue - AI Not Taking the Shortest Route

Hi everyone,

I’m having an issue with NavMesh pathfinding in Unity. Instead of taking the shortest route (yellow), my AI agent follows a much longer path (blue), as shown in the screenshot below:

Does anyone know what might be causing this and how to fix it?

Thanks in advance for any help! :rocket:

1 Like

I am not sure as you have provided very little information. My guess is that there are two different navmesh layers the lighter-coloured area with higher pathing costs, and the darker-coloured area with lower pathing costs. Your agent is trying to walk in the lower-cost area. I might be completely wrong…

2 Likes

Yes, that’s correct. The issue occurred because I was using two different NavMesh surfaces. After adjusting it to use a single surface for the entire model, the issue was fixed. Thank you!!!