Navmesh gizmos don't always show

  • A* version: 5.34
  • Unity version: all versions so far up to and including 2022.3.60f1

This has always been an issue for me. I’m not sure what does it, but after focus goes away from the scene/astar, I lose the debug draw of the navmesh even when “show surface” is still on.
None of the “show” buttons do anything at this point.
The only way to get the debug draw back is to re-scan. That’s a problem on large maps where scans take several minutes.

EDIT (and now answered): It seems that the navmesh in scene is actually lost. I tried to save the cache when the navmesh wasn’t showing as expected, and the file was nearly empty like there was no navmesh. So something seems to be clearing the navmesh in scene even though it was scanned and generated cache was updated.

Is that by design or is there someway to force whatever the last scan was to stay loaded?

Hi

When scripts are recompiled or the scene is reloaded, the graph nodes will be lost. They are too big for unity to persist. In those cases you’ll have to scan the graph again.

If you want, you can use the Save & Load tab to cache the graph so that you can just click a button to load it, and it will also be automatically loaded when the game starts.