Support Forum

Navmeshcut and saving/loading


I just realized that if I save my navmesh while cuts are active the navmesh will be saved with the holes. If I then load the navmesh it will obviously load back up with the holes but I will have no way to “disable” said holes anymore - as they’re no longer caused by a cut object.

The solution I see is that I need to disable all the navmesh cuts before I save the navmesh to file. Worst case I will have to build and maintain a collection of navmesh components but I was hoping for any of the following:

A. An internal astar function to disable/enable all cuts? May be faster than calling enable on each component one at a time

B. Failing that a list of active navmesh cut components I can access to call enable disable on?

Any sanctioned way to handle this?


Easiest is probably to just do

foreach (var cut in FindObjectsOfType<NavmeshCut>()) {
    cut.enabled = false;
// Save graph here

Considering you probably aren’t saving the graph very often, and it is probably in response to a user action, this likely has good enough performance.

You can also access NavmeshClipper.allEnabled.

Just came back to ask if it’s okay to use that. Thanks for the very quick response!

Used it and it works as expected.