Our project uses multiple recast graphs to handle AI moving in different areas. There are areas that are loaded in dynamically and players can build on top of it. Therefore we pulled some code from this repo to serialize and deserialize navmesh graph data for save/load purposes.
It basically calls graph.GetTile and graph.GetTileBounds on all tiles and save their vers and tris and call graph.ReplaceTile to load them in. It mostly works fine except occasionally some areas of the navmesh loads in like this with overlapping tiles and misalignments.
We only load into one graph at a time and this gizmo is also showing a single graph only. It happens like 1/10 chance, and when it does happen, our RichAI agents will just get stuck. I have no clue what this is indicating and where to start debugging. A temporary workaround is to call UpdateGraphs() with update physics to true to do a full update but obviously it’s not performant and I won’t know how to detect when this will happen since I am just loading a serialized byte array. Any help is appreciated!
Hi! Thanks for the reply. We recently upgraded to the latest stable version 4.2.19. If it’s possible to fix this issue without having to upgrade again or at least know what’s causing it, it would be great. But if switching to use this new NavMeshPrefab is the only way to go then I guess I’ll just spend quite some time to upgrade again
EDIT: We are using Unity 2021.3.22 and I just read we need 2022 or higher. I tried adding the registries and it only goes up to 4.3.66.
I’m not quite sure what would cause it to become overlapping.
One thing you’d have to make sure is that you compensate for the tile offset. The vertices are usually stored in graph space, not in tile space. I didn’t look too closely at the code, but it looks like it assumes the tile stays in the same position relative to the graph.
I see.Thanks for this insight! I’ll definitely double check. In case I couldn’t figure it out, is 4.3.66 a good and safe version to upgrade to? Or is the safest option to upgrade Unity as well?