Well I tried making a GraphModifier
script, that hooks on the OnPostScan
callback.
In this script I mark all nodes that are unreachable from a seed point as non-walkable using the Walkable
property of the node. Unfortunately, this doesnt fully work. As soon as a NavmeshCut
component is present in a tile, it will revert all nodes in that tile (regardless if they are affected by the cut) to walkable (as this was the initial value during the scan, which is where the cutting system caches the original tile data).
I also tried calling Destroy
on the unreachable nodes. But as the documentation says, this should not be done from user-code. And indeed, it causes various issues where part of the code does not handle destroyed nodes (one such example is the GetContours
method in GraphUtilities
).
I also tried using the example found here https://forum.arongranberg.com/t/how-to-deal-with-the-new-tiles-type-unsafe-span-removing-nodes-marked-as-unwalkable/15716/6
Unfortunately, this approach seem to cause issues where nodes/tiles might be disconnected even though they should not (usually when a node is removed near a tile edge).
Any other ideas?