AstarPath.active.UpdateGraphs scans outside specified bounds

Hi, I’m having trouble with AstarPath.active.UpdateGraphs(Bounds), as my Grid Graph is consistently updating for collisions outside of the specified bounds.

Here I have two tiles with a ‘wall’ template on them. The bottom wall will be built first.
scanbug1

As you can see, the bounds of the BoxCollider2D are exactly the size of 1 in game tile. The grid graphs is configured to scan for nodes in the center of each tile.
scanbug2

Once the “Construction” task for the bottom wall is complete, I call the following code

public virtual void OnConstructionComplete()
    {
        isConstructed = true;
        AstarPath.active.UpdateGraphs(GetComponent<BoxCollider2D>().bounds);
    }

However, the graph detects the colliders of both the constructed bottom wall (correct), and the non-constructed adjacent wall.
scanbug3

The adjacent wall should be well outside the specified bounds and I am using a fairly small circle to detect collisions.

Do you have any idea what I might be doing wrong? Thanks

Hi,

From the replies ive seen from Aron on this, this is expected. It has to calculate the adjacent areas for many reasons but is expected.

Yes. The updating the graph using a bounding box will recalculate everything that might need to be recalculated to account for changes inside that bounding box.
I would recommend that you put your non-constructed wall in a different layer while it is not yet constructed.

1 Like