How to update map walkable info after destroying GraphUpdateScene Obj

I use GraphUpdateScene component to make some obstace area unwalkable. while these obstacle could be remove. If the obstacle removed,how to update the walkable information of map?
Before I just rescan the map by astarPath.Scan();
this method cost too much.
In our game one scan may cost 100ms,and the fps reduces a lot suddenly.
Is there any other way to do it?

Hi

Are you just using it to update a part of the map after you have placed a collider or something there?
In that case I’d recommend you use the DynamicGridObstacle component instead. It will automatically take care of updating the graph after it is destroyed or if the object is moved.

It’s simply a case of updating that part of the graph again.

these objects is obstacle to some players/heros, while some is not. for eaxmple to heros which could fly, these obstacles mean nothing

“I’d recommend you use the DynamicGridObstacle component instead”

Thank you for this! I know this is a few years old but I’m now facing a similar problem and this worked like a charm.

Late to the post, but if you want to continue using GraphUpdateScene and perfrom a final refresh after the object has been destroyed you can do something like this:

void UpdateAreaAfterDestroyed()
{
    Bounds newBounds = new Bounds(transform.position, new Vector3(bounds, bounds, bounds));
    GraphUpdateObject guo = new GraphUpdateObject(newBounds);
    if (AstarPath.active)
    {
        AstarPath.active.UpdateGraphs(guo);
        Debug.Log("Astar updated");
    }
}

In my case, I get “bounds” from the scale of the object and it feels a little quicker than calculating the exact bounds from the model.