Using GraphModifier.OnPostScan, how to know which Tiles have been updated?

I am writing an Off-Mesh-Link Generator (just using some Physics.CapsuleCast checks, based on the one made by ToastyStoemp)
… and I did notice that it takes ages to calculate it for the whole map.
Now I do have destructible buildings, and I want to automatically generate off-mesh-links at runtime, when the graph updates. Instead of generating them for the entire map, I’d like to just generate them on the tiles that were updated.

Now how to get the information which Tiles have been updated, from within the GraphModifier? (I tried to check the source code but it’s not really obvious how tiles are selected …)

This information is not available in that callback. However, each recast graph has a callback named OnRecalculatedTiles that does provide this.

AstarPath.active.data.recastGraph.OnRecalculatedTiles += (NavmeshTile[] tiles) => {
    // ...
});
1 Like