Custom grid graph - how to?

Hi

You can either override the GridGraph, or you can change the data after it has been scanned, both are relatively easy.

Here is how you can modify the data:

// Make sure pathfinding is not running at the same time
AstarPath.RegisterSafeUpdate(() => {
    var gg = AstarPath.active.astarData.gridGraph;
    for (int z = 0; z < gg.depth; z++) {
        for (int x = 0; x < gg.width; x++) {
            var node = gg.nodes[z*gg.width + x];
            node.Walkable = Random.value > 0.5f;
        }
    }

    // Update connections of all nodes (needs to be done *after* all nodes have been updated)
    for (int z = 0; z < gg.depth; z++) {
        for (int x = 0; x < gg.width; x++) {
            var node = gg.nodes[z*gg.width + x];
            gg.CalculateConnections(x, z, node);
        }
    }

    // Refresh internal pathfinding data
    AstarPath.active.FloodFill();
}

Or you can override the grid graph. With this setup, graph updates will also work out of the box.
See Derive editor from GridGaphEditor?
or Using gridgraph like a tilemap
or Ability to customize collision check