Search Unity

Issue with New Runtime NavMesh Baking

Discussion in 'Navigation' started by PlutoniumFrog, Aug 16, 2018.

  1. PlutoniumFrog

    PlutoniumFrog

    Joined:
    Mar 12, 2017
    Posts:
    5
    Hello! I am currently generating a randomized dungeon within my game. After doing this, I am trying to generate a NavMesh for the entire dungeon, but there is some weird artifacts appearing when doing this. This link will show what I'm talking about:



    I am using the new NavMesh components provided by unity on their GitHub page.

    If I were to bake the same generated dungeon before runtime using the editor button for the new component, everything works perfectly. Does anybody have any clue as to why this is happening?

    The code I use to generate the mesh is as follows:
    Code (CSharp):
    1. NavMeshSurface surface = _levelOrigin.GetComponent<NavMeshSurface>();
    2. surface.RemoveData();
    3. surface.BuildNavMesh();
    All advice and help is greatly appreciated.

    Thanks!

    Edit: I found a solution to the issue. What I do now is instead of spawning in the actual meshes during the generation, I keep that object as not active. I moved a BoxCollider to the parent object so that I can check if the bounds are intersecting. If they do not intersect and the generation is valid, I then set the object containing the mesh to active. At the end, I generate the nav mesh in the same way.
     
    Last edited: Aug 16, 2018
  2. unity_o8Psq4eJg_ZjKA

    unity_o8Psq4eJg_ZjKA

    Joined:
    Jan 16, 2019
    Posts:
    1
    Hi,
    I have the same problem, any idea how to solve it?
     
  3. PlutoniumFrog

    PlutoniumFrog

    Joined:
    Mar 12, 2017
    Posts:
    5
    See my edit in the original post :)
     
  4. svlewis

    svlewis

    Joined:
    Oct 1, 2018
    Posts:
    3
    If anyone else come upon this i fixed it by selecting any static objects on top of the mesh and unchecking the static button in the inspector. I have no idea why this worked but the issue started when i started marking my static environmental
    objects
     
    y01cu likes this.
  5. y01cu

    y01cu

    Joined:
    Oct 10, 2021
    Posts:
    8
    You're a life saver :D , thanks for sharing it!