Navmesh Cut Incorrect Size (much larger)

  • A* version: 5.2.4
  • Unity version: 2022.3.39

Super randomly, when instantiating an object with a navmesh cut on it, the area that is ‘cut’ is magnitudes larger and removes a large portion of the graph.

I am unable to repro it at all - it just happens randomly. It can happen as I start the game and instantiate an object. Wasn’t able to find any similar questions in the forums either.

Any idea what I should be looking for?

image

It happened! The blue outlines are the size of the navmesh cut.

This error follows it:

InvalidCastException: Specified cast is not valid.
(wrapper castclass) System.Object.__castclass_with_cache(object,intptr,intptr)
System.Runtime.InteropServices.Marshal.GetDelegateForFunctionPointer[TDelegate] (System.IntPtr ptr) (at <c0b7b90d34a54066a7234dad69255116>:0)
Unity.Burst.FunctionPointer`1[T].get_Invoke () (at ./Library/PackageCache/com.unity.burst@1.8.17/Runtime/FunctionPointer.cs:68)
Pathfinding.Graphs.Navmesh.TileHandler.CutTiles$BurstManaged (Pathfinding.Collections.UnsafeSpan`1[Unity.Collections.LowLevel.Unsafe.UnsafeList`1[Pathfinding.Collections.UnsafeSpan`1[Pathfinding.Int3]]]& tileVertices, Pathfinding.Collections.UnsafeSpan`1[Unity.Collections.LowLevel.Unsafe.UnsafeList`1[Pathfinding.Collections.UnsafeSpan`1[System.Int32]]]& tileTriangles, Pathfinding.Collections.UnsafeSpan`1[Unity.Collections.LowLevel.Unsafe.UnsafeList`1[Pathfinding.Collections.UnsafeSpan`1[System.Int32]]]& tileTags, UnityEngine.Vector2Int& tileSize, Pathfinding.Graphs.Navmesh.TileHandler+CutCollection& cutCollection, Pathfinding.Collections.UnsafeSpan`1[Pathfinding.Graphs.Navmesh.TileMesh+TileMeshUnsafe]& output, Unity.Collections.Allocator allocator) (at ./Packages/com.arongranberg.astar/Graphs/Navmesh/TileHandler.cs:579)
Pathfinding.Graphs.Navmesh.TileHandler+CutTiles_00000B4A$BurstDirectCall.Invoke (Pathfinding.Collections.UnsafeSpan`1[Unity.Collections.LowLevel.Unsafe.UnsafeList`1[Pathfinding.Collections.UnsafeSpan`1[Pathfinding.Int3]]]& tileVertices, Pathfinding.Collections.UnsafeSpan`1[Unity.Collections.LowLevel.Unsafe.UnsafeList`1[Pathfinding.Collections.UnsafeSpan`1[System.Int32]]]& tileTriangles, Pathfinding.Collections.UnsafeSpan`1[Unity.Collections.LowLevel.Unsafe.UnsafeList`1[Pathfinding.Collections.UnsafeSpan`1[System.Int32]]]& tileTags, UnityEngine.Vector2Int& tileSize, Pathfinding.Graphs.Navmesh.TileHandler+CutCollection& cutCollection, Pathfinding.Collections.UnsafeSpan`1[Pathfinding.Graphs.Navmesh.TileMesh+TileMeshUnsafe]& output, Unity.Collections.Allocator allocator) (at <aa2b8079e88b4ab99dc9a33eed34d7bb>:0)
Pathfinding.Graphs.Navmesh.TileHandler.CutTiles (Pathfinding.Collections.UnsafeSpan`1[Unity.Collections.LowLevel.Unsafe.UnsafeList`1[Pathfinding.Collections.UnsafeSpan`1[Pathfinding.Int3]]]& tileVertices, Pathfinding.Collections.UnsafeSpan`1[Unity.Collections.LowLevel.Unsafe.UnsafeList`1[Pathfinding.Collections.UnsafeSpan`1[System.Int32]]]& tileTriangles, Pathfinding.Collections.UnsafeSpan`1[Unity.Collections.LowLevel.Unsafe.UnsafeList`1[Pathfinding.Collections.UnsafeSpan`1[System.Int32]]]& tileTags, UnityEngine.Vector2Int& tileSize, Pathfinding.Graphs.Navmesh.TileHandler+CutCollection& cutCollection, Pathfinding.Collections.UnsafeSpan`1[Pathfinding.Graphs.Navmesh.TileMesh+TileMeshUnsafe]& output, Unity.Collections.Allocator allocator) (at ./Packages/com.arongranberg.astar/Graphs/Navmesh/TileHandler.cs:433)
Pathfinding.Graphs.Navmesh.TileCutter+JobCutTiles.Execute () (at ./Packages/com.arongranberg.astar/Graphs/Navmesh/TileHandler.cs:266)
Unity.Jobs.IJobExtensions+JobStruct`1[T].Execute (T& data, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at <2d8783c7af0442318483a199a473c55b>:0)

Wow that’s a fun glitch- very fortunate you were able to get the error and a screenshot! I’ll let @aron_granberg know about this one. Any other information you can provide about your set up would be helpful as well! Graph and NavmeshCut settings and info- stuff like that :slight_smile:

1 Like

NavmeshCut settings are completely default. I have two graphs and only one of which the NavMeshCut does not intersect. Everything else is pretty much default!

image

This sounds like it could potentially be a burst bug. Could you try to see if you can still replicate it using a newer version of Unity?

1 Like

How did it go?

Sorry for the delay! I upgraded to Unity 6 and so far it hasn’t happened despite several attempts at repro which is good news! I will let you know if that changes.

Thanks Aron!

1 Like