NavMeshCut causing huge spike in GC and long time to complete

I have a scene with couple of navmeshcut objects.

Initially they are all not moving so everything is fine.

And then when I turn one of the navmeshcut object on or off (enable = false or true) I get huge spike in both ms to complete the call and the GC

For GC I get + 1.4MB
For MS I get 18ms call on AstarPath.Update()

This is basically… too much in every way even for just using for simple door simualtion.

I am using pretty fast PC and I think something must gone wrong, but I can’t tell what.

My scan on recast graph takes around 800ms which is fine.

I did take a look at the example , but it also produces pretty lot GC and ms to do it.

I do understand that navmeshcut isn’t very cheap call to make, but is there any factors I should be aware of for producing good performing navmeshcut setting?

Hi

The update cost of a navmesh cut is roughly proportional to the amount of geometry it has to update, which is proportional to the tile size of the recast graph. So the best way to reduce the cost would be to reduce the tile size.

The first call might take longer to complete due to JITing.

Ok, so by tile , I assume I have to use “Use Tiles” option for “Use Tiled Graph”.
And then try and keep the Tile Size to low?

Can you explain what the number for the tile size actually mean?
(also region size if you can!)

I need to understand what these numbers actually mean relative to the other values so I can figure out the best combination for my scene.

Hi

The recast graph first rasterizes the whole world into voxels (think minecraft, but much smaller scale), each one of these voxels are [cell size] large. The tile size is the number of voxels along one side of the tile. Similarly, the min region size is the minimum number of voxels required in a region for it not to be filtered away.

Usually you don’t think much about the voxels though. You can see how large the tiles are by looking at the generated graph from above (make sure Show Mesh Outline and Show Graphs is enabled), you should see a distinct tile pattern with a small enough tile size.

The image below shows a similar tile pattern (note that this graph wasn’t actually generated using a recast graph, but the tiling is similar).
<img src=’/uploads/default/533/b9787dfe5fc1f706.jpg’

Arhh , I see. Thanks for the explanation. If my scene takes more than couple of seconds to generate its navmesh ( dynamic world ) then I would like to display some progress bar. Is it possible to scan the graph using thread or anything like that? I think I saw some where in the forum that the scan in runtime is done in one call…

What is the best way of displaying the progress in the runtime scan?

I have scan on awake checked on and then when I load the scene ( async ) my usual loading progress bar is stopped during what seems like recast graph scan.

For future reference (I see you have already posted in the thread) http://www.arongranberg.com/vanillaforums/discussion/2987/astarpath-active-scan-async-alternative#latest