GraphUpdateObjects makes all nodes around itself walkable

When we use GraphUpdateObject on some area, it makes one more row of nodes walkable from each side, which then interacts with the GraphUpdateObject, but they are not recalculated with physics to check if they should become unwalkable again.

The red rectangle is the GraphUpdateObject area. I made black dots into the nodes that were unwalkable before the GrapthUpdateObject was used.

Hi

If you scan the graph from the inspector, do those black dots become unwalkable again?

Which version of the package are you using?

Hey

Yes, after rescaning the nodes become unwalkable again.

We are on the latest version 5.1.1.

I am sorry. This is not your issue. I caused this when I tried to fix another issue with GraphUpdateObject. I’ll update you on the other issue once I collect more info on it.

Hey, I made a project on GitHub that reproduces the bug.
GitHub: GitHub - PetrSeifert/AStarBugReproductions

In this example, all nodes are set to an unwalkable state at the start. Then four GraphUpdateObjects are called, and even though there is an obstacle over the whole grid, a walkable outline is created around each place where the GraphUpdateObject was called.

Hi

This is working as intended.
When a graph update is done on a grid graph (and guo.updatePhysics = true, which is the default). Then it will recalculate all nodes from scratch, that might have been changed by any colliders changing inside the bounding box. This means that it will recalculate nodes slightly outside the bounding box too.
In this case, those nodes find that there are no obstacles there, so the nodes are made walkable.

But there is an obstacle on the whole graph. If I call GraphUpdateObject on the whole graph, then all nodes are calculated as unwalkable, but if I call GraphUpdateObject only on part of the graph, then the nodes around the GraphUpdateObject will be walkable even though there is an obstacle on them.

Update 1: When I say there is an obstacle on the whole graph, I don’t mean the GraphUpdateObject, but the GridGraph in the scene.

Not in the example, right? You are just making all nodes unwalkable manually at the start?

In the example, there is a scene with obstacle on the whole grid graph. When you start the game, my script sets all nodes to an unwalkable state directly, and then the four GraphUpdateObjects are called. These shouldn’t do anything as there shouldn’t be a single node walkable because of the obstacle, but that’s not the case, and the nodes around the GraphUpdateObjects are set to a walkable state.

Update 1:
You can see the walkable outlines around the GraphUpdateObjects these shouldn’t be there.

Try not avoid setting the walkable state directly if you are also doing other graph updates.
It interacts poorly with other features such as erosion and such. In this case, I believe the edge comes from you not setting the WalkableErosion property, which is required to handle erosion correctly.

If you need to set it directly, prefer to use the GridGraph.SetWalkability method, as this will take care of some edge cases. GridGraph - A* Pathfinding Project