GridGraph update


#1

Hi! I am new here so be patient! :slight_smile: The question is how to update grid graph after obstacle was destroyed?
AstarPath.active.UpdateGraphs (ob.collider.bounds); This will work if I created a new one but what to do with an obstacle that I just destroyed?


#2

Hi

You can do the exact same thing, destroy the object and then update the graphs using the bounding box of the object. By default the UpdateGraphs call will recalculate that part of the graph, so it works both for adding and removing obstacles.

Alternatively you can add the DynamicGridObstacle component which will do all this automatically for you.


#3

Thanks! I will try DynamicGridObstacle.