navmeshagent stuck trying to traverse offmeshlink with "Auto Traverse Off Mesh Link" set to False

here, an agent stands on a sort of balcony with 1 way out through navmesh and 3 ways out through offmeshlinks. it tries to traverse an off mesh link that is right in front of it, but it isn’t allowed to do that - in the agent settings, the option “Auto Traverse Off Mesh Link” is turned off. it gets stuck trying to take this “shortcut” instead of going around through navmesh.

https://i.imgur.com/xHGg92x.png

alt text

i’m using Unity 2017.1, offmeshlinks aren’t mentioned anywhere in the code, the path for this particular case is generated by agent’s NavMeshAgent.SetDestination(target); , but CalculatePath and SetPath are also used elsewhere and were made to reach incomplete path (mentioning this in case it may affect SetDestination()'s work ).

turns out off mesh links belong to the “Jump” navigation area!

solution:

  • remove Jump area from agent’s Area Mask list (disabling Auto Traverse Off Mesh Links isn’t enough);
  • whenever a path needs to be calculated with parameters, use agen’t own walkable area settings by getting it’s .AreaMask to make sure a path that doesn’t use offmeshlinks will be built.