Dynamic generation of NavMesh

Hello!

I’m fairly new to Unity gamedev & NavMesh generation as a whole.

I’m creating an “infinite world” game where I generate new areas to traverse in lines rather than chunks. In this infinite world there will be creatures spawning that should be able to move and care for the environment (walk around a tree, for example).

Looking into A* Pathfinding Project it looks like it has a bunch more features that the built-in Unity one. However one thing I can’t find in neither is:

The possibility to generate & remove parts of the NavMesh in runtime. Is this possible or do I need to recalculate the entire NavMesh everytime a new piece of world is generated?

See this video to understand what my game is doing in runtime:
https://i.imgur.com/Ik6HAC4.mp4

In the docs for “Creating graphs during runtime” there is a mention of a “re-scan”. Would this re-scan consider the entire area or just the additions/subtractions made to the original NavMesh?

You have a few options here! Namely I’d recommend looking at Recalculating parts of graphs- more specifically GraphUpdateObject. With this you can specify specific areas (maybe around the creatures?) that get scanned every once in a while.

More direct to your question, there is also Navmesh Cutting and conversely NavmeshAdd. Depending on how you plan on spawning creatures and have them interact with the world (such as how far away will they want to pathfind) you may need a different approach.