Optimizing many Dynamic Grid Obstacles


I have a scene with a large amount of gameobjects with the Dynamic Grid Obstacle component. Since each component uses the Update monobehavior, it is very taxing on performance. I’ve tried disabling all objects that are a certain distance from the player and re-enabling when close.

However, disabling the Dynamic Grid Obstacle component seems to break pathfinding. It seems I would need to run a full grid scan upon enabling the component which would defeat the purpose of improving performance.

Do you know of any ways to potentially improve performance for this component? I have checked out the performance optimization page and enabled multithreading which helps, but disabling this component on all of the objects pretty much doubles my framerate so if there’s a way to disable/enable them performantly that would be awesome.


It looks like DynamicGridObstacle is just doing a graph update under the hood.
You could instead run your own code to decide when to do a graph update on each object and call it manually, eg:

Bounds bounds = (however you need to calculate object bounds on the object)

True, but the real performance killer is having an Update loop on so many objects. I was wondering if there was a more efficient way to update the graph.