Modifying Walkability in GraphUpdateScene not updating with UpdateGraphs()

Hi,

So I’ve run into a weird issue. I have a GraphUpdateScene on a component. If an interaction happens on that component, I update its GraphUpdateScene to have WalkabilityValue = true. After I have set this, I call AstarPath.Active.UpdateGraphs(myGameObjectsBounds);. Unfortunately, this does not update correctly. If I call AstarPath.active.Scan() it does update correctly, but this is both expensive and not possible in my situation because I have some layers hidden that then get missed out in this scan.

Is this known? Am I doing something wrong?

Hi

With WalkabilityValue = true you will mark all nodes inside the bounding box as walkable.
Maybe instead you want to set guo.modifyWalkability=false, and guo.updatePhysics = true. This will make it behave as if you recalculated that part of the graph from scratch (like Scan()).

So this is correct, I do want to mark the nodes as walkable. I also set updatePhysics = true.

Here is my update code:

And this is my Rescan method:
image

I have checked and my bounds are correct.

Hi

Setting updatePhysics = true makes no sense when also setting modifyWalkability. Then you will just recalculate the nodes from scratch, only to replace all their walkability values with true.

Make sure that your bounding box covers the nodes even on the Y axis.

Ok, I updated my Rescan code to look like this:

image

I expand the bounds to ensure I hit the nodes. This still does not update the nodes as expected.

For reference, after my code has run, if I go to my pathing component and hit scan, it does calculate correctly, as can be seen here:
image

Is there a functional difference between Scan() and UpdateGraph()? In my GraphUpdateScene on my door I have ApplyOnScan = true, is that picked up in the UpdateGraph()?

Here is my GraphUpdateScene if it helps:
[After My Code has run + before I call UpdateGraph:
image

[At Start] :
image

Yes, a GraphUpdateScene with ApplyOnScan will not be executed during a graph update. A GraphUpdateScene itself is just a graph update.
If you want to apply a graph update scene during runtime you can call the Apply method on it. See GraphUpdateScene - A* Pathfinding Project

Welp, that did it :smiley:

Thank you very much!

1 Like