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?