Navmesh Null exception in 5.22

  • A* version: 5.22 Pro
  • Unity version: 2022.3.21f1

I have some agents walking around a navMesh and I am getting occasional null exceptions:

NullReferenceException: Object reference not set to an instance of an object
Pathfinding.ECS.MovementPlaneFromGraphSystem.SampleSmoothNavmeshNormal (Pathfinding.TriangleMeshNode node, System.Collections.Generic.List1[T] scratchList, Unity.Collections.NativeList1[T] scratchBuffer, Unity.Mathematics.float3 position, System.Single agentRadius, Pathfinding.ECS.AgentMovementPlane& agentMovementPlane, System.Single alpha) (at ./Packages/com.arongranberg.astar/Core/ECS/Systems/MovementPlaneFromGraphSystem.cs:134)
Pathfinding.ECS.MovementPlaneFromGraphSystem+JobMovementPlaneFromNavmeshNormal.Execute (Pathfinding.ECS.ManagedState managedState, Unity.Transforms.LocalTransform& localTransform, Pathfinding.ECS.AgentMovementPlane& agentMovementPlane, Pathfinding.ECS.AgentCylinderShape& shape) (at ./Packages/com.arongranberg.astar/Core/ECS/Systems/MovementPlaneFromGraphSystem.cs:100)
Pathfinding.ECS.MovementPlaneFromGraphSystem+JobMovementPlaneFromNavmeshNormal.Execute (Unity.Entities.ArchetypeChunk& chunk, System.Int32 chunkIndexInQuery, System.Boolean useEnabledMask, Unity.Burst.Intrinsics.v128& chunkEnabledMask) (at ./JobEntityGenerator/Unity.Entities.SourceGen.JobEntityGenerator.JobEntityGenerator/Temp/GeneratedCode/AstarPathfindingProject/MovementPlaneFromGraphSystem__JobEntity_130988311188.g.cs:39)
Pathfinding.ECS.MovementPlaneFromGraphSystem+JobMovementPlaneFromNavmeshNormal.Unity.Entities.IJobChunk.Execute (Unity.Entities.ArchetypeChunk& chunk, System.Int32 unfilteredChunkIndex, System.Boolean useEnabledMask, Unity.Burst.Intrinsics.v128& chunkEnabledMask) (at <98ae279b469a43b4a73c05f1db19b484>:0)
Unity.Entities.JobChunkExtensions.RunByRefWithoutJobs[T] (T& jobData, Unity.Entities.EntityQuery query) (at ./Library/PackageCache/com.unity.entities@1.3.2/Unity.Entities/IJobChunk.cs:256)
Unity.Entities.Internal.InternalCompilerInterface+JobChunkInterface.RunByRefWithoutJobs[T] (T& jobData, Unity.Entities.EntityQuery query) (at ./Library/PackageCache/com.unity.entities@1.3.2/Unity.Entities/Internal/InternalCompilerInterface.cs:495)
Pathfinding.ECS.MovementPlaneFromGraphSystem.__ScheduleViaJobChunkExtension_0 (Pathfinding.ECS.MovementPlaneFromGraphSystem+JobMovementPlaneFromNavmeshNormal job, Unity.Entities.EntityQuery query, Unity.Jobs.JobHandle dependency, Unity.Entities.SystemState& state, System.Boolean hasUserDefinedQuery) (at <98ae279b469a43b4a73c05f1db19b484>:0)
Pathfinding.ECS.MovementPlaneFromGraphSystem.OnUpdate (Unity.Entities.SystemState& systemState) (at ./Packages/com.arongranberg.astar/Core/ECS/Systems/MovementPlaneFromGraphSystem.cs:59)
Pathfinding.ECS.MovementPlaneFromGraphSystem.__codegen__OnUpdate (System.IntPtr self, System.IntPtr state) (at <98ae279b469a43b4a73c05f1db19b484>:0)
Unity.Entities.SystemBaseRegistry+<>c__DisplayClass9_0.b__0 (System.IntPtr system, System.IntPtr state) (at ./Library/PackageCache/com.unity.entities@1.3.2/Unity.Entities/SystemBaseRegistry.cs:249)
UnityEngine.Debug:LogException(Exception)
Unity.Debug:LogException(Exception) (at ./Library/PackageCache/com.unity.entities@1.3.2/Unity.Entities/Stubs/Unity/Debug.cs:17)
Unity.Entities.<>c__DisplayClass9_0:b__0(IntPtr, IntPtr) (at ./Library/PackageCache/com.unity.entities@1.3.2/Unity.Entities/SystemBaseRegistry.cs:253)
Unity.Entities.UnmanagedUpdate_0000164F$BurstDirectCall:wrapper_native_indirect_0000024064BF8940(IntPtr&, Void*)
Unity.Entities.UnmanagedUpdate_0000164F$BurstDirectCall:Invoke(Void*)
Unity.Entities.WorldUnmanagedImpl:UnmanagedUpdate(Void*) (at ./Library/PackageCache/com.unity.entities@1.3.2/Unity.Entities/WorldUnmanaged.cs:825)
Unity.Entities.WorldUnmanagedImpl:UpdateSystem(SystemHandle) (at ./Library/PackageCache/com.unity.entities@1.3.2/Unity.Entities/WorldUnmanaged.cs:891)
Unity.Entities.ComponentSystemGroup:UpdateAllSystems() (at ./Library/PackageCache/com.unity.entities@1.3.2/Unity.Entities/ComponentSystemGroup.cs:717)
Unity.Entities.ComponentSystemGroup:OnUpdate() (at ./Library/PackageCache/com.unity.entities@1.3.2/Unity.Entities/ComponentSystemGroup.cs:687)
Pathfinding.ECS.AIMovementSystemGroup:OnUpdate() (at ./Packages/com.arongranberg.astar/Core/ECS/Systems/AIMovementSystemGroup.cs:165)
Unity.Entities.SystemBase:Update() (at ./Library/PackageCache/com.unity.entities@1.3.2/Unity.Entities/SystemBase.cs:418)
Unity.Entities.ComponentSystemGroup:UpdateAllSystems() (at ./Library/PackageCache/com.unity.entities@1.3.2/Unity.Entities/ComponentSystemGroup.cs:723)
Unity.Entities.ComponentSystemGroup:OnUpdate() (at ./Library/PackageCache/com.unity.entities@1.3.2/Unity.Entities/ComponentSystemGroup.cs:681)
Unity.Entities.SystemBase:Update() (at ./Library/PackageCache/com.unity.entities@1.3.2/Unity.Entities/SystemBase.cs:418)
Unity.Entities.DummyDelegateWrapper:TriggerUpdate() (at ./Library/PackageCache/com.unity.entities@1.3.2/Unity.Entities/ScriptBehaviourUpdateOrder.cs:523)

The game still works, but it seems to be something exclusive to the A* Project plugin.
EDIT: Using the FollowerEntity component walking on a custom navmesh.
Meshes have some NodeLink2 connecting them, if that is relevant.

Thanks. This was indeed a bug. I’ll include a fix in the next update.

Btw. The Movement Plane Source = Normal mode is primarily intended for spherical worlds or other strange shapes. For most games, the Graph mode is faster and more useful.