Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Question Did navmesh change with unity 2020 LTS? NavMeshBuilder.BuildNavMesh issue.

Discussion in 'Navigation' started by Vaupell, Apr 28, 2021.

  1. Vaupell

    Vaupell

    Joined:
    Dec 2, 2013
    Posts:
    301
    Hi All,

    Playing around with a procedural generated dungeon, and need navmesh after generation.
    Recently i started using 2020LTS and found NavMeshBuilder.BuildNavMesh is not a thing anymore.

    so when i

    Using Unityengine.AI;

    I can only use BuildNavMeshData now..
    upload_2021-4-28_15-2-3.png

    No usefull information found in the documentation.. Any ideas?

    Unity Documentation:
    https://docs.unity3d.com/ScriptRefe...6.1702589442.1619420118-1879260839.1603800554
     
  2. ChrisKurhan

    ChrisKurhan

    Joined:
    Dec 28, 2015
    Posts:
    265
  3. CSNomadProductions

    CSNomadProductions

    Joined:
    Mar 4, 2020
    Posts:
    12
    So does this mean NavMeshBuilder isn't something that will function at runtime?

    Working on something with procedural levels (and Bolt Scripting) and all the bits and pieces seem to be there, but I can't seem to get any of it to work :/

    Edit: I was doing some digging and it looks like you need to use an external package? NavmeshComponents?

    https://github.com/Unity-Technologies/NavMeshComponents
     
  4. ChrisKurhan

    ChrisKurhan

    Joined:
    Dec 28, 2015
    Posts:
    265
    No, you can use NavMeshBuilder at runtime, there are just some methods, like BuildNavMesh, that are not available at Runtime. You can see AI Series Part 14 for how you can use NavMeshBuilder at Runtime.

    NavMeshComponents are a set of helpful tools that improve your NavMesh working experience, but I don't think they're required for NavMeshBuilder.
     
  5. CSNomadProductions

    CSNomadProductions

    Joined:
    Mar 4, 2020
    Posts:
    12
    I see.

    So in my case where I generate a level with static pre-fab rooms, the best approach would be to use NavMeshBuilder?
     
  6. ChrisKurhan

    ChrisKurhan

    Joined:
    Dec 28, 2015
    Posts:
    265
    If it's generated at runtime, yes I would use NavMeshBuilder.

    To achieve that you'd register some NavMeshData with the NavMesh, then use the NavMeshBuilder to update the NavMeshData you registered and the NavMesh will update
     
    CSNomadProductions likes this.
  7. CSNomadProductions

    CSNomadProductions

    Joined:
    Mar 4, 2020
    Posts:
    12
    Makes sense.

    I did find another solution using Navmesh Components. If you get the package, you can simply attach the NavMeshSurface component, bake the NavMesh in the prefab (although it’s important to note the PreFab won’t show the baked NV for some reason)

    from there I just of run my map builder algorithm and the PF’s come with the NV’s ready to go.

    I wonder why it’s still a preview package, as it seems to work quite reliably.
     
    ChrisKurhan likes this.