Overlapping GraphUpdateScenes => inconsistency

  • A* version: 5.3.3
  • Unity version: 6000.0.36f1

When I have two overlapping — or just adjacent — GraphUpdateScene objects, I get inconsistent results on re-scanning the graph. It’s as if they alternate their influence and break the other object around the edges. Here are some screenshots of the setup and results: :point_down:
(this is all scanning in editor)

As you can see, on each scan, a different grid node is set as walkable/not walkable :point_down:
(this alternates on each Scan)

:point_down: Below is the setup on the GraphUpdateScene component.
(These objects have trigger BoxColliders that are not included in the graph scanning)

Screenshot 2025-03-21 at 10.59.31

Is there a way to fix this?

AN ALTERNATE SOLUTION: SCAN FOR TRIGGERS

If I could make the GridGraph scan include triggers, I would not need the GraphUpdateScene objects! I could just put these trigger volumes on the ‘Obstacles’ layers in the GridGraph, which seems intuitive and easy as well!

But since the GridGraph obstacle scan doesn’t include triggers, I need the GraphUpdateScene…

Turning off Update Physics fixed this behavior on my end. If that’s not required you can turn that off and you should be good :+1:

I am not 100% sure of the intention of that setting in general or in this use case though :thinking: if it’s something you need for your project let me know and I’ll tag Aron on this to review if it’s possibly a bug or just something I’m not understanding.

Thanks so much!

That did help.

I am running into another variation of the problem now, though :face_holding_back_tears:

When I create a Dynamic Obstacle at runtime, the neighboring cells have their tags cleared!

The tag is applied by a GraphUpdateScene component: :point_down:

I’m in a thread working on something semi-related so my first thought is, as a test, trying shrinking the collider and see if it still happens? If that fixes it you may want to consider using the list of points. If not let me know!

1 Like

Heyy! Thanks!

Shrink which collider? Of the DynamicObstacle or of the GraphUpdateScene that changes the tag?

How does DynamicObstacle work actually? Does it just use bounds of any Collider attached to the same object?

Of the DynamicObstacle :smiley: I’m mainly wondering if this happens if neighboring nodes are being caught in the update… but then why would that be clearing thier tag specifically :thinking: Time to open Unity and investigate :slight_smile:

Yeah it grabs the bounds from the collider. Just looked through the code and it’s pretty much just the bounds of the collider from what I’m reading. (As well as the bounds of where it was before to rescan and restore those nodes)

1) Shrinking Collider

So I shrunk the collider, tho it was already MUCH smaller than a single grid cell…

It didn’t have an effect.

2) Non-Trigger Collider

So I’m getting a little closer to a workaround/solution.

Turning off “IsTrigger” on the GraphUpdateScene’s collider fixes the update (preserves tags).:partying_face:
I toggled “IsTrigger” DURING playing.

But then, for this to also work when starting the game (and the initial scan):

  • the collider’s layer must be included in the scan
  • the collider must not be a Trigger.

=> Which then causes the grid to be ON TOP of the GraphUpdateScene collider:

:thinking:

Screenshot 2025-04-18 at 09.00.38

It’s kind of weird that GraphUpdateScene works at “initial scan” with a Trigger collider, but when updating the graph it no longer works with a Trigger collider?

EDIT: Actually, nevermind this. I can’t find a combination of these settings at edit or play time that will leave the tags alone without putting the grid on top of the marker collider.

(But I am not familiar with the flow of GraphUpdateScene / DynamicObstacle is… Does a DynamicObstacle trigger a complete re-scan? Are GraphUpdateScenes supposed to re-apply their properties after that? Or is DynamicObstacle actually supposed to leave the tags alone ?)

3) Using Points

So I tried using the points array instead of a collider (which is much less convenient for editing in this scenario, but that aside).

Unfortunately the behaviour is the same:

So, verdict: I’m stuck! I tried every combination of settings I could think of! I tried toggling IsTrigger after scanning the grid at runtime, etc. But nothing gives me the desired behavior of just leaving the tags alone! :joy:

Hmm I’m gonna tag @aron_granberg here because it’s feelin’ a little buggy when I play around with it too. For now though, you can keep this from being an issue by scanning affected areas after the DynamicObstacle moves when near it, to have the tags remain. Not an ideal way of doing it, but so long as we rescan to fix the issues that the DynamicObstacle is creating we should be good temporarily :slight_smile:

Heya @tealtxgr @aron_granberg ,
I’m still having this issue. I updated to the latest version (5.4.3) hoping that there would be some changes, but I’m still stuck!

Placing a DynamicObstacle removes surrounding tags

Here you see that when I place an object that has a DynamicObstacle on it, it resets the Tags in the adjacent grid squares (near the front of the car).
(Those squares had a ‘NotBuildable’ tag on them, which got removed.)

Screenshot 2025-09-16 at 14.16.38

Scan after every placed object?

This seems to work but I am worried about performance?

This is the first time I’m seeing this game in motion and let me say first, it looks very good! Nice work!

This isn’t too terrible of an option really. Especially if you only scan the surrounding area I can’t imagine this eating too much performance, since it’s not every frame or anything.

1 Like

Hi

What’s happening is that the DynamicObstacle tells the graph: “hey, recalculate nodes completely from scratch, assuming the world changed in this particularregion”. This will require it to recalculate nodes in a slightly larger region than the passed bounds, to ensure it takes all collision settings into account. And recalculating nodes from scratch involves resetting all tags.

There are some workarounds for this:

  1. You can modify the DynamicObstacle script (or make your own copy of it) so that whenever it creates a GraphUpdateObject, you also set guo.resetPenaltyOnPhysics = false;. This will make it try to preserve any penalties and tags on the nodes when they are updated.
  2. Instead of assigning tags using manually graph updates with guo.setTag, you can for example use the Per Layer Modifications rule in the grid graph settings. See Grid Graph Rules - A* Pathfinding Project . This allows you to have colliders in specific layers, that when they occupy a node will cause that node to get a specific tag. This is much more robust, but it does require you to actually have colliders in place. You still need a graph update to make the graph notice the object, but the graph update can just recalculate the nodes from scratch, you don’t have to manually tell it to set the tags, as that will be done automatically.

Btw. Got to agree with @tealtxgr . The game looks really nice :slight_smile:

1 Like

Thanks to both of you! :smiling_face: (it’s called GARBAGE COUNTRY, it’s half driving, half Tower Defense). And A* project has been great! I’ve gone from grid to recast and back and it’s great how flexibly it all works! And now I’m even tying the “Can I build here?” logic into A*, through tags, which is also pretty great!

I think this is what I’m doing now!

Setting up rules for that layer plus calling Scan() after each object gives me a working situation! And performance should be fine, as @tealtxgr mentioned, the grid is tiny to small anyway.

1 Like

You don’t need to call scan, though. You can just do a normal graph update (even a DynamicObstacle will work, as that’s basically what it does).

Just as long as the graph is recalculated in the region you care about, it will work out of the box when you have set up the rules :slight_smile:

Ah, I see! That’s not yet what I was doing!

You’re saying:

  1. don’t use GraphUpdateScene?
  2. use only a (Box)Collider on a specific layer?
  3. Then create a ‘Per Layer Modifications’ rule that sets that maps that layer to a tag?

I am having some issue setting that up though.. From what I gather.

  1. That collider cannot be a Trigger
  2. The layer must be included in the GridGraph’s "Obstacle Layer Mask" or it won’t be picked up.
  3. The layer must be included in the "Height testing Mask" for same reason.

The issue I’m having then is that the grid appears on top of this collider. But I want the grid to lie on the underlying terrain.

This is the setup:

The grid is then on top of that collider: