Navmesh, Dynamic Changes, and Saving

Hello,

I’m making a game that involves base building.

I was going to use Unity’s NavMesh together with the dynamic NavMesh components on github, but I found out recently that the player cannot save any of the changes he or she makes to the NavMesh during gameplay. This renders Unity’s navmesh solution, even with the added components from github, practically useless for a building game.

I noticed your navmesh has dynamic capabilities. Can you use your navmesh to place and remove buildings, resources etc? And can the player save the changes he or she makes to the navmesh when the game is saved?

Thanks for reading.

Best wishes,

Owen

Hey,

There are two ways methods of taking care of changes in environment.
For more dynamic objects, like a crate the player can move around, you can rely on Navmesh Cutting this will dynamically remove parts of the navigation mesh.

For more long term changes you can update the navigation mesh, or partially update. More information about that here: https://arongranberg.com/astar/docs/graphupdates.html

The package does support loading and saving of generated navigation data. I’m not 100% sure if this would work in runtime, Aron would be able to give you a better answer. However here is the documentation page explaining more in detail: https://arongranberg.com/astar/docs/saveloadgraphs.html

Thanks for the reply.

Have you used the astar project’s navmesh in an rts/building game where you have to add/remove buildings and recalculate the navmesh accordingly? I read the sections of the documentation you referred me to, but I’m still not sure whether it will work in that sort of game. I really need to hear from either the developer or someone who has actually used the navmesh for that sort of game.

Hi

While it is possible to save the navmesh including changes in this package, what you typically do in games like this is to re-apply any navmesh updates when you load the game again, or you just recalculate the whole graph at load time. So if the player has placed a building you save that information instead.

In most cases you would just re-scan the graph after a saved game has been loaded, which will make sure it is up to date.