Function GridGraph.SetWalkability

SetWalkability (bool[] walkability, IntRect rect)

Set walkability for multiple nodes at once.

Public
void SetWalkability (

bool[]

walkability

IntRect

rect

)

Set walkability for multiple nodes at once.

If you are calculating your graph's walkability in some custom way, you can use this method to copy that data to the graph. In most cases you'll not use this method, but instead build your world with colliders and such, and then scan the graph.

Note

Any other graph updates may overwrite this data.

// Perform the update when it is safe to do so
AstarPath.active.AddWorkItem(() => {
var grid = AstarPath.active.data.gridGraph;
// Mark all nodes in a 10x10 square, in the top-left corner of the graph, as unwalkable.
grid.SetWalkability(new bool[10*10], new IntRect(0, 0, 9, 9));
});

See

Grid Graph Rules for an alternative way of modifying the graph's walkability. It is more flexible and robust, but requires a bit more code.