Advantages of UpdateGraph() vs manually changing nodes?

Specifically, I’m only wanting to change one or a few nodes at a time. What is the difference between using a GraphUpdateObject with UpdateGraph(), and just changing the properties of the node(s) directly?

Hi

A graph update object is intended as an easier way of updating the graph than changing nodes directly. If it is easier for you to update the nodes directly, then you should do that. However make sure that you read: http://arongranberg.com/astar/docs/graph-updates.php#direct. In particular you must only change the node properties when it is safe to do so, otherwise the pathfinding queries might return incorrect results.

So using UpdateGraph(...) will do all of the extra stuff like AstarPath.FloodFill(...) and GridGraph.CalculateConnections(...) for me?

Yes, it will do all that.

1 Like