Search Unity

NavMeshAgent.isOnOffmeshLink always returns false.

Discussion in 'Navigation' started by DennisGregs, Apr 7, 2020.

  1. DennisGregs

    DennisGregs

    Joined:
    Feb 4, 2020
    Posts:
    9
    Hello guys,

    I have a situation where I move my character using the NavMesh. Currently using NavMeshAgent.velocity, but I have also used NavMeshAgent.Move() with the same results. I have disabled updateRotation, as well as autoTraverseOffMesh, and isOnOffmeshLink returns false 100% of the time.

    Why would that be? I did find a thread in the past where OP had the same issue, but there hasn't been an official answer to it. As far as I'm aware, isOnOffmeshLink is specifically designed to be used when we want to explicitly move our character through offmesh links, such as having direct control over it, so I don't see why this wouldn't work?

    Thanks in advance for your input.
     
    Tymianek and DungDajHjep like this.
  2. Invinciblade

    Invinciblade

    Joined:
    Mar 13, 2021
    Posts:
    1
    After a few hours of debugging, I found that isOnOffMeshLink will only be set to true if the OffMeshLink the agent is touching is part of the path generated via a call to SetDestination. I can't find anywhere in the docs that this is mentioned, but seems to be true from my testing. Hopefully this saves some time if anyone happens across this question later!
     
    theferfactor, Tymianek and hj526 like this.