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

No NavMesh on certain GameObjects (Baking at Runtime)

Discussion in 'Navigation' started by charleshendry, Jan 16, 2018.

  1. charleshendry

    charleshendry

    Joined:
    Jan 7, 2018
    Posts:
    95
    Hi,

    I have a procedurally generated city where I'm trying to bake a navmesh at runtime onto certain gameobjects. I have a script that marks all gameobjects as static and assigns layer IDs to the ones I want the navmesh for (roads & pavements). I use NavMeshBuilder.CollectSources to assign a navmesh to this layer and in general it seems ok as part of the navmesh is there.

    The issue is that I have two prefabs that make up the roads (a corner prefab and a straight prefab). Navmesh bakes fine for corner prefabs, but won't appear on the straight prefabs. Both are static and both have the same layer ID.

    NavMesh.png

    If I manually place a few instances of each prefab into the scene and click Bake, a navmesh is created ok on both prefab types.

    Can't work out what it could be as I assume the script should be ok (as corner roads bake ok), all gameobjects are static and both road gameobject types have the same layer ID. I'm using Unity 2017.3. Any advice much appreciated.
     
  2. ZoopTEK

    ZoopTEK

    Joined:
    Feb 14, 2012
    Posts:
    22
    I am having a similar problem. Did you ever figure out what was wrong?
     
  3. charleshendry

    charleshendry

    Joined:
    Jan 7, 2018
    Posts:
    95
    Sorry, should have posted the issue here at the time! Yes I'd resolved it but can't remember what it was and my setup is very different now. But I think it was something within the navmesh builder settings, adjusting bounds or vector may have solved it. Good luck!