[Bug] Custom Mesh NavMeshCut broken by Tiles feature

NavMeshCut works fine when it’s set to use defined shapes and placed on the Tile grid, but it seems to get cut into half most of the time when it’s set to use a custom mesh.


Which version are you using?

Sorry for the late reply, I’m using version 4.3.47

This thread is quite old, but I’m running into the same issue as OP using version 4.3.75 beta. I’m generating the mesh used for the cut through code, but it only applies the cut correctly for a single contour. If there are multiple contours within the mesh, it seems to only cut a single one of them as long as Use Tiles is enabled on the navmesh.

With Use Tiles disabled:

With Use Tiles enabled:

Additionally, though this may be a limitation of the system, it doesn’t seem to support “holes” in the custom mesh. The mesh I’m trying to cut is all of the green squares in the screenshot above, but notice how the two 2x2 yellow tile chunks are still being cut despite there being no mesh there.

After a little more digging, it seems like this is being caused by the bounds only taking a single contour into account to determine which tiles to cut (seemingly the smallest contour? Or maybe just the first contour that finishes getting built).

The small contour here is intersecting just 6 tiles, but the large contour also slightly intersects the bottom left one, giving the small cut there.

Found the issue! In the GetBounds() function in NavmeshCut.cs, it creates a new Rect if k == 0, which erases any min/max information from contours in previous loops. I was able to fix it by changing it to (k == 0 && i == 0)

Thanks! Great debugging!

I’ve fixed this in my dev version now. The fix will be included in the next beta update.