Hi I have a possibly simple issue that I’ve googled and searched but cannot figure out.
if (border_obstacles[i] != null) {
var guo = new GraphUpdateObject(border_obstacles[i].GetComponent<BoxCollider2D>().bounds);
guo.updatePhysics = true;
guo.bounds.extents += new Vector3(5000, 5000, 0);
Destroy(border_obstacles[i]);
AstarPath.active.UpdateGraphs(guo);
}
The behavior I expect is that the obstacle is removed, and new Paths can go through it. I can see in the scene that the obstacle is removed, I can see that the graph gizmos show blue where it was (not gray) - so it looks like a valid location now. But when a new path gets calculated 2 seconds later, it avoids the obstacle as if it was there.
I am extending the bounds because my movement uses Tags, and I wanna make sure Erosion is recalculated in a bigger area. its probably unnecessary but I wanted to make sure.
Since you are using tags, are you sure the tags have been properly cleared? You can visualize the tags by changing the debug mode/graph coloring mode in A* Inspector -> Settings.
Ah. You are using a 2D collider.
If you call 2DCollider.bounds you will get back a bounds object that has a zero size along the Z axis. However the graph will check for each node if they were contained in the bounding box, but since the bounding box has no size along the Z axis it is impossible for them to be contained by it. Try to add some size along the Z axis and it should work.
I agree that this can be a bit confusing when making 2D games, but it is very important to check all axes in 3D games (especially when the graphs contain multiple floors).