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

NavMesh Modifiers are completely ignored

Discussion in 'Navigation' started by Wrymnn, May 11, 2019.

  1. Wrymnn

    Wrymnn

    Joined:
    Sep 24, 2014
    Posts:
    352
    NavMesh Modifer and NavMesh Modifier Volume components are doing exactly nothing.
    I have read entire docs on them, and they should work, but they don`t.

    This is NavMesh Modifier Volume:

    - modifier area set to Non-Walkable
    - clicking Bake generates nav-mesh, but ignores both Modifier
    - NavMesh Modifer with mesh does not work as well

    upload_2019-5-11_14-30-36.png
    upload_2019-5-11_14-31-25.png

    Any ideas what is happening?

    Yes here it seems everything is working just fine:

    upload_2019-5-11_14-35-14.png
     
  2. Yandalf

    Yandalf

    Joined:
    Feb 11, 2014
    Posts:
    491
    Stupid suggestion, but are the objects with the modifier volumes set to navigation static?
     
  3. Wrymnn

    Wrymnn

    Joined:
    Sep 24, 2014
    Posts:
    352
    Do you mean GameObject’s “static” property? Or some other component/setting in Navigation?
     
  4. Wrymnn

    Wrymnn

    Joined:
    Sep 24, 2014
    Posts:
    352
    Okay got it, it has to be marked as Navigation Static.
    How would you go about changing areas in runtime? Is it necessarily to bake the entire mesh again? Since small nav mesh obstacles can carve holes in runtime without huge performance costs... it should be same with carving new areas, right?
     
  5. Yandalf

    Yandalf

    Joined:
    Feb 11, 2014
    Posts:
    491
    I'm honestly not quite sure, but the obstacles are possibly using different means to carve themselves out.
    You might indeed have to rebake, but if I remember correctly the NavMeshBuilder does keep track of the changed parts and only rebuilds those, so it is more performant than one might initially fear.
    If it turns out the areas change in realtime without any further work, then they might just automatically trigger a rebuild when changed this way and you shouldn't worry about things.
     
  6. ahxel

    ahxel

    Joined:
    Aug 4, 2018
    Posts:
    2
    encountered this same problem. here's how I was able to resolve it in Unity 2019.3
    1. Create a NavMesh Surface (GameObject > AI > NavMesh Surface)
    2. In the Hierarchy, transfer existing GameObjects with a NavMeshModifierVolume component to the NavMesh Surface created in step 1 (i.e. make them child objects of the NavMesh Surface from step 1)
    3. Bake the navmesh again. (note: I did this from the Inspector window, not the Navigation window. In the Hierarchy, select the NavMesh Surface created from Step 1 and there should be a Bake button in the Inspector window)
    4. Delete the old navmesh surface by going to the folder of your current scene and deleting the old NavMesh file (the new navmesh has a suffix '-NavMesh Surface', the old one doesn't)
     
  7. Karrzun

    Karrzun

    Joined:
    Oct 26, 2017
    Posts:
    123
    I'm really sorry to necro this thread but I've been running into the same problem lately: when creating a NavMesh dynamically at runtime, the NavMeshSurface goes ahead and creates the NavMesh for all corresponding GameObjects (itself and its children) like it is supposed to. However, I've added a NavMeshModifier component to one GameObject, that's a child of the NavMeshSurface GameObject, and set it to "Override Area --> Not Walkable". The resulting NavMesh does include this GameObject whereas I would expect it to be "cut out".

    I tried following the steps described in the post above but that didn't fix anything either. I'd be more than grateful if anybody has an idea what I'm doing wrong.


    Thank you in advance!


    //Edit: My project runs on Unity version 2019.3.5f1 in case that's important.
     
  8. Raziid

    Raziid

    Joined:
    Jun 13, 2017
    Posts:
    8
    If you are still on this, using a NavMeshObstacle might be a better use for that. Or NavMeshModifierVolume.

    Check to make sure you don't have any other modifiers that could be screwing it up. From the docs:
    The NavMesh Modifier affects GameObjects hierarchically, meaning the GameObject that the component is attached to as well as all its children are affected. Additionally, if another NavMesh Modifier is found further down the transform hierarchy, the new NavMesh Modifier overrides the one further up the hierarchy.​
     
  9. JasonBSteele

    JasonBSteele

    Joined:
    May 31, 2016
    Posts:
    9
    I am also having this problem with NavMeshModifierVolume. I have a small cube which is Navigation Static and Not Walkable. I have added a NavMeshModifierVolume and made it much bigger than the cube and set it to Not Walkable. I then Baked and got the following:

    upload_2021-7-7_16-22-30.png

    You should see that the mostly buried cube is not walkable, but that the volume (which also intersects the Ground Plane) remains Walkable.

    Unity 2020.3. Any ideas?
     
  10. JasonBSteele

    JasonBSteele

    Joined:
    May 31, 2016
    Posts:
    9
    So I have played around with this some more and discovered that if I Bake my `NavMeshSurface` using it's own Bake button rather than the general Navigation Window one it works - I get a hole carved in the NavMesh.

    It seems that their are two systems - wither I use the NavMesh Window and set the require objects to `Navigation Static`, or I use the individual NavMeshSurface components which rely on their `Collect Objects` property rather than `Navigation Static`. This second method seems to include the `NavMeshModifierVolume` whereas the first does not.
     
  11. nscarrci

    nscarrci

    Joined:
    Jan 15, 2022
    Posts:
    1
    Another thing to check is the layer that the NavMeshModifierVolume is in. If it isn't in the Default layer you may need to go to your NavMeshSurface and adjust the included layers.

    That's what it was for me, I'd moved a prefab to a custom layer while testing out a new feature and then completely forgot to move it back.
     
  12. EL-soNK

    EL-soNK

    Joined:
    Jul 13, 2015
    Posts:
    28
    Thank you very much, nscarrci! This exactly was the problem I ran into -- changed the layer of some objects and navmesh modifier was ignored.
     
    GreaserMonkey likes this.