Hi Aaron!
I sometimes get crashes when loading player saves. At this point, a lot of objects are created that either cut off the navmesh below them or generate it above them.
After reading a few topics, I assumed it was due to a data race when using threads. I switched the settings to update in a non-threaded coroutine. Unfortunately, this did not help.
How can I fix this? Are there any rules to follow when dealing with a lot of objects? Or do I need to fine-tune the A* settings?
- A* version: 5.0.2
- Unity version: 2022.3.16f1
NullReferenceException: Object reference not set to an instance of an object
at Pathfinding.HierarchicalGraph+JobRecalculateComponents.Execute () [0x00024] in <4537c686c0d9405a89b5e12be0e24066>:0
at Unity.Jobs.IJobExtensions+JobStruct`1[T].Execute (T& data, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) [0x00001] in <9fade6610f4a492a86602edcaed0e6d8>:0
at (wrapper delegate-invoke) Unity.Jobs.IJobExtensions+JobStruct`1+ExecuteJobFunction[Pathfinding.HierarchicalGraph+JobRecalculateComponents].invoke_void_T&_intptr_intptr_JobRanges&_int(Pathfinding.HierarchicalGraph/JobRecalculateComponents&,intptr,intptr,Unity.Jobs.LowLevel.Unsafe.JobRanges&,int)
NullReferenceException: Object reference not set to an instance of an object
at Pathfinding.NavmeshEdges+JobCalculateObstacles.CalculateObstacles (Pathfinding.HierarchicalGraph hGraph, System.Int32 hierarchicalNode, Pathfinding.Util.SlabAllocator`1[T] obstacleVertexGroups, Pathfinding.Util.SlabAllocator`1[T] obstacleVertices, Unity.Collections.NativeArray`1[T] obstacles, Unity.Collections.NativeList`1[T] edgesScratch) [0x000b6] in <4537c686c0d9405a89b5e12be0e24066>:0
at Pathfinding.NavmeshEdges+JobCalculateObstacles.Execute (System.Int32 startIndex, System.Int32 count) [0x00074] in <4537c686c0d9405a89b5e12be0e24066>:0
at Unity.Jobs.IJobParallelForBatchExtensions+JobParallelForBatchProducer`1[T].Execute (T& jobData, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) [0x0000f] in <ddcff769129b448e969cc1bc72b4a07a>:0
at (wrapper delegate-invoke) Unity.Jobs.IJobParallelForBatchExtensions+JobParallelForBatchProducer`1+ExecuteJobFunction[Pathfinding.NavmeshEdges+JobCalculateObstacles].invoke_void_T&_intptr_intptr_JobRanges&_int(Pathfinding.NavmeshEdges/JobCalculateObstacles&,intptr,intptr,Unity.Jobs.LowLevel.Unsafe.JobRanges&,int)
IndexOutOfRangeException: Index was outside the bounds of the array.
at Pathfinding.Graphs.Navmesh.NavmeshTile.GetVertex (System.Int32 index) [0x00019] in <4537c686c0d9405a89b5e12be0e24066>:0
at Pathfinding.NavmeshBase.GetVertex (System.Int32 index) [0x0000b] in <4537c686c0d9405a89b5e12be0e24066>:0
at Pathfinding.TriangleMeshNode.GetVertices (Pathfinding.Int3& v0, Pathfinding.Int3& v1, Pathfinding.Int3& v2) [0x0000c] in <4537c686c0d9405a89b5e12be0e24066>:0
at Pathfinding.NavmeshEdges+JobCalculateObstacles.CalculateBoundingBox (Pathfinding.HierarchicalGraph hGraph, System.Int32 hierarchicalNode) [0x00066] in <4537c686c0d9405a89b5e12be0e24066>:0
at Pathfinding.NavmeshEdges+JobCalculateObstacles.Execute (System.Int32 startIndex, System.Int32 count) [0x0006b] in <4537c686c0d9405a89b5e12be0e24066>:0
at Unity.Jobs.IJobParallelForBatchExtensions+JobParallelForBatchProducer`1[T].Execute (T& jobData, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) [0x0000f] in <ddcff769129b448e969cc1bc72b4a07a>:0
at (wrapper delegate-invoke) Unity.Jobs.IJobParallelForBatchExtensions+JobParallelForBatchProducer`1+ExecuteJobFunction[Pathfinding.NavmeshEdges+JobCalculateObstacles].invoke_void_T&_intptr_intptr_JobRanges&_int(Pathfinding.NavmeshEdges/JobCalculateObstacles&,intptr,intptr,Unity.Jobs.LowLevel.Unsafe.JobRanges&,int)