Hi
The easiest way is probably to subclass the grid graph and add in your check for if the cell is visible or not:
You can subclass it like this:
using pathfinding;
public class MyGridGraph : GridGraph {
public override void RecalculateCell (int x, int z, bool resetPenalties = true, bool resetTags = true) {
base.RecalculateCell(x, z, resetPenalties, resetTags);
var node = nodes[z*width + x];
// Modify the node here somehow
if (node is not visible in fog of war) node.Walkable = true;
// Need to set this if you modify the walkability in any way, otherwise erosion will not work
node.WalkableErosion = node.Walkable;
}
}
// In an editor script
using pathfinding;
[CustomGraphEditor(typeof(MyGridGraph), "My Grid Graph")]
public class MyGridGraphEditor : GridGraphEditor {
}
Then you can use a graph update to update the grid wherever the units are or slightly more performantly: wherever the FOW changes.
Here is a (really old) video of me using this trick https://www.youtube.com/watch?v=6HcMYCS08XQ