- Home /
NavMesh Modifier not changing navmesh
I'm working on a city builder, and I'm beginning to implement roads for faster travel within cities. I'm trying to attach a NavMesh modifier in order to make the certain area where I placed the road a "Road" Area Type which would enable faster movement for a Humanoid agent. When I instantiate a Road gameObject (as a child of an empty gameObject) with a NavMesh Modifier component attached the NavMesh doesn't change.
Road GameObject Configuration:
I'm using a NavMesh Surface and updating it every time I instantiate a Road gameObject. The NavMesh Surface is attached to a gameObject.
This is the configuration of my NavMesh:
If any more information is needed, just comment and I will be happy to add! Thank you for your help! (NavMesh Modifier Volumes don't work either, although properly configured)
Answer by o0oradaro0o · Oct 29, 2019 at 09:24 PM
I don't have a full solution but i think you need to mark the road prefab as navmesh static (where it says static at the very top right in the inspector)
if you did happen crack this in the past 454 days please do share. I'm working this same problem for the same genre of game we might need to call updateNavmesh in the navmeshSerface script and make some edits to that script but and it might not update instantly but it should be fine for city builders to run it in the background.
Answer by ahxel · Nov 04, 2020 at 12:01 AM
encountered this same problem. here's how I was able to resolve it in Unity 2019.3
(side note: OP seems to already have a NavMesh Surface. he might need to do only step 4 below)
Create a NavMesh Surface (GameObject > AI > NavMesh Surface)
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)
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)
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)
cc: @o0oradaro0o