"Is Path Possible" only detecting the first graph

When the agents start fighting a small collider is turned on to allow them to block the path, this collider is set on a second Grid Graph that is exactly like the main one but with a smaller diameter and a different Obstacle layer mask, the problem is that I can’t get “PathUtilities.IsPathPossible” to return the combined result of all the Grid Graphs, it only seems to care about the first one, so the result is true even if the path is totally blocked (and it is visually blocked too by the scan), how can I truly see if the path is blocked with multiple graphs?

Hi

IsPathPossible takes nodes as inputs, so if your graphs are independent and not reachable from each other, you need to loop through the graphs and run the query for each graph:

var nn = NNConstraint.Default;
for (int i = 0; i < AstarPath.active.data.graphs.Length; i++) {
    nn.graphMask = 1 << i;
    var startNode = AstarPath.active.GetNearest(startPoint, nn);
    var endNode = AstarPath.active.GetNearest(endPoint, nn);
    if (startNode.node != null && endNode.node != null && IsPathPossible(startNode.node, endNode.node) {
        Debug.Log("At least one valid path");
    }
}

Thanks for answering! I will look into that but if possible how do I make them dependant and reachable? I’m happy to have them working as one, I only created another one because of the diameter change.

If they are different graphs for different unit types, you most definitely want them to be separate.