IsPathPossible not work

hi guys
I create a gridgraph runtime

and it looks like:

but when I checked like
PathUtilities.IsPathPossible (gg.nodes[2 *gg.width + 1], gg.nodes[2 *gg.width + 4])
it aways return True. why
Wait for your reply.
Thanks!!!:rose:

Hi

The reason is that when updating the walkability of a grid graph the connectivity of the nodes needs to be recalculated as well. This is mentioned in the docs about updating graphs during runtime, but there is no code example for it, so I understand it can be easy to miss. I have added a code example to my dev version now and I have pasted it into this post as well:

AstarPath.active.AddWorkItem(new AstarWorkItem(ctx => {
	var gg = AstarPath.active.data.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];
			// This example uses perlin noise to generate the map
			node.Walkable = Mathf.PerlinNoise(x * 0.087f, z * 0.087f) > 0.4f;
		}
	}
	
	// Recalculate all grid connections
	// This is required because we have updated the walkability of some nodes
	gg.GetNodes(node => gg.CalculateConnections((GridNodeBase)node));
	
	// Update the 'area' information in the graph.
	// This is required because we have updated the connectivity of the graph
	ctx.QueueFloodFill();
}));

The above code will generate this graph (using a sufficiently large grid graph):