UpdateGraphsNoBlock apparently killable?

I’ve got a weird problem, probably a mistake on my side.

guo = new GraphUpdateObject(Fsm.GetOwnerDefaultTarget(target).collider.bounds); //gameObject.collider.bounds startNode = AstarPath.active.GetNearest (Start.Value); endNode = AstarPath.active.GetNearest (End.Value); PathIsPossible.Value = GraphUpdateUtilities.UpdateGraphsNoBlock(guo, startNode, endNode, false);

No error or warning and it works great most of the time. However, when my bounds actually contain (or are very close to) either the start or end node, the function no longer works. It always returns false, no matter if my object is in the way or not. I can move it off the graph after that and it’ll still return false. It even returns false if the objects’ bounds are 0/0/0. Is this a bug or did I somehow do something wrong?



Sure that the graph update does not make the start or end nodes unwalkable and by that it will never be possible to reach the end point again from the start point again.
Note that passing false to the UpdateGraphsNoBlock function will make the graph updates not to be reverted if the update did not block. Try passing true to it instead.

ah thanks ,I think I see now. The UpdateGraphsNoBlock function actually applies to the graph first and then sees if there’s a possible path between the two nodes. I thought it would do all that on an instance of a graph so that it would work like : “If I put this gameObject here, would it block the path?” . But if it actually changes walkability then the code probably needs to look like this :

guo = new GraphUpdateObject(Fsm.GetOwnerDefaultTarget(target).collider.bounds); guo.trackChangedNodes = true; startNode = AstarPath.active.GetNearest (Start.Value); endNode = AstarPath.active.GetNearest (End.Value); PathIsPossible.Value = GraphUpdateUtilities.UpdateGraphsNoBlock(guo, startNode, endNode); guo.RevertFromBackup() ;

This gives me an error:

InvalidOperationException: Changed nodes have not been tracked, cannot revert from backup

I tried my best to solve this on my own, but for one it’s hard to work with a function that’s not documented (the entire GraphUpdateUtilities is not documented, the more the pitty because they seem to be quite useful functions), and on the other hand I do not understand how the nodes are not tracked if I explicitly set the guo.trackChangedNodes to true.


There are some beta docs you can look at: http://arongranberg.com/astar/docs_beta/class_pathfinding_1_1_graph_update_utilities.html#a5cca2a0658c53d66d366a2ba495498f1

It is interesting though, because if your start and end points are always identical, it should never totally block the path. It should revert the update so that it does not block.

The trackChangedNodes value is used by the UpdateGraphsNoBlock function and reset to false at the end of the function call.

Try passing True as the last argument to the function, then it should always revert the guo. If that also causes it to fail, then you have found a bug.

PS: Are you perhaps using a grid graph with erosion?

yes I was. Now I just disabled the collider and call the function again right after seeing if the path would be possible. Works like a charm, if a bit expensive. Thanks!