UpdateGraph with Bounds on PointGraph

I must be overlooking something very basic, but it seems like I’m overlooking something. I have the Pro version of A* and I’d like to update a part of my pointGraph using AstarPath.active.UpdateGraphs() with a Bounds object.

The whole deal is in 2D. I have 2D Physics turned on in the graphs. Everything works and nodes connect I when simply use AstarPath.active.Scan(). Although the points are very close together and max distance of 0.25f.

There are also 2 graphs, both pointGraphs, with similar settings but differing tags. They should both update.

What happens is this:

  1. I usean isometric Z as Y tilemap
  2. Every tile instantiates a couple of GameObjects which have the required tag (PathNode and RoadNode for the respective pointGraphs, or UnpathNode for non-walkable ones). Every node is on Z=0.
  3. When I update a tile in any tilemap, I create a Bounds at that location (in world position instead of cell position of course - I have tested this visually by using a gameobject with a 2d box collider and use its bounds). This is the very simple method:
Bounds bounds = new Bounds(worldPos, new Vector3(3f, 3f, 0f));

However, no connections are created using this method even though other, nearby nodes are well within the size of those bounds. What’s up? What am I overlooking? I am using 4.2.17.



A point graph will not look for new gameobjects with tags when you try to update the graph. If you want to create new nodes there are two options. Either you can use pointGraph.AddNode, and then issue your graph update. Or you can just call AstarPath.active.Scan() (definitely the simplest option if your graph is small enough that the performance is not a problem).

Ah I made an assumption there, I guess. Thank you for your reply! I was also using way too many nodes, 7 per tile(!) With some proper settings on the Seeker I could do with just 1 node per tile. 7x more efficient…!

I’ve never gotten the whole AddWorkItem thing down, though. That’s what’s necessary to AddNode and AddConnection, isn’t it? I feel there’s some flexibility there that I am not accessing yet.

Also, I really have to get my brain in order that a Node ≠ a classic gameObject as I create them (with the tag that the Scan looks for).