Some background: Currently using Pro version 4.3.47. Our project has been suffering from a lot of KeyNotFoundExceptions consistently and finally, the dreaded Too Many Perturbations error started appearing.
I know that this error is the result of too many of such warnings that appear, and I want to check if there are any best practices to prevent any of these warnings.
Here’s a list of points that describe how the NavMesh in our game are being set up:
- Our game is a procedural dungeon crawler, which pieces of rooms are stitched together, and then the boundary of the entire map is scanned to create the NavMesh
- The combined floor (walking NavMesh) have colliders and a unique layer to be detected and scanned by the Recast graph. They can overlap at times or share edges/points. Their shapes are all rectangular and not rotated in any way.
- All props such as walls and barrels that block the player have a NavMeshCut components. They are disabled before the scanning starts, and reactivated after the scanning ends. That’s where all the KeyNotFoundExceptions appear.
- The walls, like the floor, are arranged in a way that conforms to a regular grid. The NavMeshCut components have a buffer that’s consistently bigger than visuals, so walls being placed beside each other will have their NavMeshCut bounds overlapping.
- The barrels and other obstacles are not placed according to the grid and the overlapping are probably more complex compared to the walls.
- There are a lot of walls, barrels and other obstacles in the scene (Averaging 900).
I have a realization while writing this that it might just be the copious amount of overlapping between NavMeshCuts that cause the warnings to happen. I.e. Some regions are cut out by 3 different NavMeshCuts. There’s probably other places that has more trying to cut out the same space.
A lot of warnings are thrown by the walls alone; I’ve disabled all barrels and obstacles, leaving only the walls.
Any thoughts on this?