Scanning too slow - Loading graph nodes at runtime without scanning

We are creating a game with sections that load at runtime, and we need this to happen without any breaks in gameplay.

We we load a new section, we need to load a new graph in that section. If we use saving and loading of a NavGraph, the deserialization causes a lag. If we use a GridGraph, the scan method causes a lag.
We placed the scanLoop method in a Coroutine to slow down grid graph scanning and spread the work over several frames, and that works without causing any lag, but it could end up being too slow for gameplay.

Is there a way to create a basic grid graph by loading the node data for a graph directly into AstarData.graphs? We thought this might be a way to avoid running the scan method. We could then set all the nodes to walkable, and then at runtime use the UpdateGraph method to just update each part of the level as it is loaded. Or would this not give any performance increase?

Also, we wondered if there was a way to strip out some of the functionality of the grid graph if we are creating our own type of graph (that inherits from GridGraph) to increase performance? No matter how many nodes we have in a grid graph, scan time is never less than 16ms, which made us wonder if there was some sort of delay that we could avoid?


Have you looked at the Procedural example scene? That has a grid graph in an infinite world.

Well, you can load the data directly, but that’s basically what the deserialization already does, so I am not sure how much you would gain. When deserializing it just takes in a binary stream of data and loads it into the nodes, it is pretty fast.
Maybe you could use smaller graphs so that each load doesn’t take as long.

Can you strip out collision testing and or height testing? If so disable those options in the grid graph settings.
Erosion is also pretty expensive so use small values for that if possible.