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

Access 5.6 NavMeshLink script

Discussion in 'Navigation' started by Michael_Waltham, Apr 4, 2017.

  1. Michael_Waltham

    Michael_Waltham

    Joined:
    Aug 20, 2014
    Posts:
    31
    In the previous Navigation system, I could access the offmesh link script by simply calling:

    Agent.currentOffMeshLinkData.offMeshLink


    when I detect that my agent is on an offmesh link. I see in the new system that the NavMeshLink does not extend the classic offmesh link and so the above method returns null.

    How can I go about accessing the new NavMeshLink script when I detect that my agent is on an offmesh link?
     
  2. Jakob_Unity

    Jakob_Unity

    Joined:
    Dec 25, 2011
    Posts:
    269
    Michael_Waltham likes this.
  3. Michael_Waltham

    Michael_Waltham

    Joined:
    Aug 20, 2014
    Posts:
    31
    Perfect, thanks for the assist :)
     
  4. Hugo-Bille

    Hugo-Bille

    Joined:
    Jul 6, 2012
    Posts:
    6
    There wouldn't happen to be a similar workaround if I want to find the NavMeshLink equivalent of NavMeshAgent.nextOffMeshLinkData? We'd like to switch over from OffMeshLinks to NavMeshLinks but some of our existing code needs to be able to read the links (specifically the start position) before the agent is actually on them.