Don't Generate NavMesh In Certain Tiles [Solved]


we have a huge maps of 300x300 grid tiles using recast graph. Entire map is flat unity terrain, there is no elevation with this unity terrain.

Half of the map is mountains, where we do not want units to walk into. However, these mountains are 3d models, drawn via GPU instancing, thus there are no physical gameobjects or meshes in the scene from them.

Each mountain is always 1x1 tile big.

Now, for now I have been using navmesh cut for each of these mountains (generating one from code dynamically), to block navmesh generation. The issue is, there can be tens of thousands of tiles with mountains, this means tens of thousands of navmesh cut objects and components. Noticing profiler, this is eating considerable amount of FPS.

Is there any way how to solve this issue? Maybe blocking out the tiles using code API only, without instantiating tens of thousands components?

Thank you


You could add in the meshes into the recast scanning process using code. See CollectionSettings - A* Pathfinding Project

1 Like

Thank you for this info, did not know it was possible.

However I am trying but failing to add the meshes with the API, as the usage is quite complex.

Would you please give me a working example, where we would add a simple quad mesh to a certain world position? This is just to block the navmesh generation, no need to add entire mountain mesh.

So the goal is to block that 1x1 tile in certain position from generating navmesh.

This would be a lifesaver, thank you!

Never mind for now, managed to just generate simple cube mesh on position and block pathing, will test more and see if all works, if so, we could close this issue, which would be a huge help for our project.

1 Like

Confirming, creating simple cube mesh via code, and adding it into collection of Astar works amazing, no runtime performance impact!

Huge thanks.

1 Like