How to handle many navmeshes in 1 scene ?

Hi,
I used unity2019.3

I do use navMesh and navMeshAgent.

My goal is to change the navmesh on runtime: at begin, player can only walk in small red circle, then after some conditions, he can walk in a big rectangle area (small red circle is inside the big rectangle area)

Is it possible to have 2 navmeshes and then switch them by setActive(bool) ?

Any idea on how to achieve that ?

150983-unity1.jpg

You don’t need several Navmeshes, a single one with several areas will work.

Then, set the mask on your agent according to your conditions.

agent.areaMask = 1 << index_of_1st_layer |
    1 << index_of_2nd_layer |
    1 << index_of_3rd_layer;

That looks promising… but I just cannot find how to edit an area: when baked, it bakes always the WHOLE big rectangle.

  • How can I add a circle area in a navmesh ?