Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

OffMeshLinkData vs NavMeshLink

Discussion in 'Navigation' started by phaem, Jul 27, 2017.

  1. phaem

    phaem

    Joined:
    Jan 5, 2015
    Posts:
    76
    Hello Unity community!

    I'm trying to get current and next area indicies while NavMeshAgent is moving along it's path over links. With the new Unity 2017.1 NavMeshLinks where added to the scene along with old OffMeshLinks. The OffMeshLinkData struct do not contains field for area index, only link start and end points. Instead, there's a property of type OffMeshLink returning link object with all it's data.

    When the agent is moving over NavMeshLink instead of OffMeshLink, it's flag isOnOffMeshLink is true but the offMeshLink property of the link data struct is null making it impossible to get the area index for current and next links along agent's path.

    I've researched into the data struct and found it stores link instance id as a private field. I've indexed all links in the scene using static Dictionary<int, NavMeshLink> in the Awake method and when required, the program read the private id value from the data struct with reflection and get the appropriate link from the index.

    This solution seems a little excessive to me. My question is, what is Unity way to get agent's current and next NavMeshLink link object reference and/or it's area index?
     
  2. DioArvin

    DioArvin

    Joined:
    Oct 29, 2013
    Posts:
    2
    same problem...
     
  3. Date_Time

    Date_Time

    Joined:
    Jun 10, 2019
    Posts:
    2
    Same problem, bump
     
  4. Date_Time

    Date_Time

    Joined:
    Jun 10, 2019
    Posts:
    2