NaveMeshSurface.BuildNavMesh() produces bad results

Hi,

I am using the AI.Navigation system on the following scene :

Since it’s a scene with element which will be deleted dynamically, I’m not baking the scene beforehand but call once
Floor.GetComponent().BuildNavMesh();

“Floor”, beeing the game object holding the NavMeshSuface component.
The first call does a pretty good job (Except for some reason it exclude the player with the NavMeshAgent, although the player also has a NavMeshModifier component with remove, why ?).

Then the next time Floor.GetComponent().BuildNavMesh(); gets called, is when the the game object on the left (the dumpster/garbage) is set to inactive. And then the results is completly wrong :

What am I not understanding, doing wrong ? I would like to be able to create a dynamic mesh at runtime which will adapt to active/inactive objects preset with NavMeshModifiers (add/remove). For example, if the dumpster blocks a path, setting it to inactive should “open the path”.

I’ve followed all tutorials I could find, but still can’t understand what I am doing wrong.

Thanks

Ok fixed it buy using NavMeshObstacle and NavMeshModifier components properly