Support Forum

[4.3.40] GraphUpdateObject by specific nodes of GridGraph

Hello!
How to start updating the graph for specific nodes.
Commonly used “AstarPath.active.UpdateGrahps(Bounds)”. It works great with custom GridGraphRule.

But I want to update not by bounds, but by specific nodes.
Like this:

GraphUpdateObject guo= new GraphUpdateObject();
guo.changedNodes = new List<GraphNode>();
guo.changedNodes.Add(gridGraph.GetNode(1, 1));
guo.changedNodes.Add(gridGraph.GetNode(5, 5));
AstarPath.active.UpdateGraphs(guo);

But nothing changes.

The main condition is that the GridGraphRule needs to work with updating specific nodes

Hi

You can create a bounding box around only that node.

new Bounds((Vector3)node.position, Vector3.one*0.1)

The grid graph internally inherently works by updating rectangular regions of the graph. Not individual nodes.

1 Like