Hi there, my project was working perfectly (for path finding at leas! ) but I needed to upgrade to a higher version of unity for an unrelated reason. I updated path finding to 4.3.90 at the same time, along with Entities to 1.0.16.
After these two upgrades I stated getting the null reference exception described below, followed by another error that appears related to the Jobs system.
Edit: Unity version 2022.3.15f1. I am having a hard time reproducing these errors consistently.
Error 1:
NullReferenceException: Object reference not set to an instance of an object
Pathfinding.HierarchicalGraph+JobRecalculateComponents.Execute () (at ./Library/PackageCache/com.arongranberg.astar@4.3.90/Core/Pathfinding/HierarchicalGraph.cs:503)
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 <5879d8d225474494bcffdfe64965038e>:0)
Unity.Jobs.JobHandle:ScheduleBatchedJobsAndComplete(JobHandle&)
Unity.Jobs.JobHandle:Complete()
Pathfinding.HierarchicalGraph:RecalculateIfNecessary() (at ./Library/PackageCache/com.arongranberg.astar@4.3.90/Core/Pathfinding/HierarchicalGraph.cs:564)
Pathfinding.WorkItemProcessor:EnsureValidFloodFill() (at ./Library/PackageCache/com.arongranberg.astar@4.3.90/Core/Misc/WorkItemProcessor.cs:268)
Pathfinding.WorkItemProcessor:ProcessWorkItems(Boolean, Boolean) (at ./Library/PackageCache/com.arongranberg.astar@4.3.90/Core/Misc/WorkItemProcessor.cs:362)
Pathfinding.WorkItemProcessor:ProcessWorkItemsForUpdate(Boolean) (at ./Library/PackageCache/com.arongranberg.astar@4.3.90/Core/Misc/WorkItemProcessor.cs:416)
AstarPath:PerformBlockingActions(Boolean) (at ./Library/PackageCache/com.arongranberg.astar@4.3.90/Core/AstarPath.cs:904)
AstarPath:Update() (at ./Library/PackageCache/com.arongranberg.astar@4.3.90/Core/AstarPath.cs:887)
Error 2:
UnityException: GetOrCreateTrackerHandleImpl can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
UnityEditor.Profiling.EditorPerformanceTracker.GetOrCreateTrackerHandle (System.String trackerName, System.Type context) (at <64861216782042de93237b5c061bff1b>:0)
UnityEditor.EventWithPerformanceTracker.GetPerformanceTrackerHandleForEvent (System.String scope, System.Delegate d) (at <64861216782042de93237b5c061bff1b>:0)
UnityEditor.EventWithPerformanceTracker`1+DelegateWithHandle[T].StartTrackerAt (System.Int32 idx, System.String scope) (at <64861216782042de93237b5c061bff1b>:0)
UnityEditor.EventWithPerformanceTracker`1+Enumerator[T].MoveNext () (at <64861216782042de93237b5c061bff1b>:0)
UnityEditor.EditorApplication.Internal_PauseStateChanged (UnityEditor.PauseState state) (at <64861216782042de93237b5c061bff1b>:0)
Unity.Jobs.JobHandle:ScheduleBatchedJobsAndComplete(JobHandle&)
Unity.Jobs.JobHandle:Complete()
Pathfinding.HierarchicalGraph:RecalculateIfNecessary() (at ./Library/PackageCache/com.arongranberg.astar@4.3.90/Core/Pathfinding/HierarchicalGraph.cs:564)
Pathfinding.WorkItemProcessor:EnsureValidFloodFill() (at ./Library/PackageCache/com.arongranberg.astar@4.3.90/Core/Misc/WorkItemProcessor.cs:268)
Pathfinding.WorkItemProcessor:ProcessWorkItems(Boolean, Boolean) (at ./Library/PackageCache/com.arongranberg.astar@4.3.90/Core/Misc/WorkItemProcessor.cs:362)
Pathfinding.WorkItemProcessor:ProcessWorkItemsForUpdate(Boolean) (at ./Library/PackageCache/com.arongranberg.astar@4.3.90/Core/Misc/WorkItemProcessor.cs:416)
AstarPath:PerformBlockingActions(Boolean) (at ./Library/PackageCache/com.arongranberg.astar@4.3.90/Core/AstarPath.cs:904)
AstarPath:Update() (at ./Library/PackageCache/com.arongranberg.astar@4.3.90/Core/AstarPath.cs:887)
Error 3
NullReferenceException: Object reference not set to an instance of an object
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) (at ./Library/PackageCache/com.arongranberg.astar@4.3.90/Core/Misc/NavmeshEdges.cs:234)
Pathfinding.NavmeshEdges+JobCalculateObstacles.Execute (System.Int32 startIndex, System.Int32 count) (at ./Library/PackageCache/com.arongranberg.astar@4.3.90/Core/Misc/NavmeshEdges.cs:157)
Unity.Jobs.IJobParallelForBatchExtensions+JobParallelForBatchProducer`1[T].Execute (T& jobData, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at ./Library/PackageCache/com.unity.collections@2.1.4/Unity.Collections/Jobs/IJobParallelForBatch.cs:58)
Unity.Jobs.JobHandle:ScheduleBatchedJobsAndComplete(JobHandle&)
Unity.Jobs.JobHandle:Complete()
Pathfinding.HierarchicalGraph:RecalculateIfNecessary() (at ./Library/PackageCache/com.arongranberg.astar@4.3.90/Core/Pathfinding/HierarchicalGraph.cs:564)
Pathfinding.WorkItemProcessor:EnsureValidFloodFill() (at ./Library/PackageCache/com.arongranberg.astar@4.3.90/Core/Misc/WorkItemProcessor.cs:268)
Pathfinding.WorkItemProcessor:ProcessWorkItems(Boolean, Boolean) (at ./Library/PackageCache/com.arongranberg.astar@4.3.90/Core/Misc/WorkItemProcessor.cs:362)
Pathfinding.WorkItemProcessor:ProcessWorkItemsForUpdate(Boolean) (at ./Library/PackageCache/com.arongranberg.astar@4.3.90/Core/Misc/WorkItemProcessor.cs:416)
AstarPath:PerformBlockingActions(Boolean) (at ./Library/PackageCache/com.arongranberg.astar@4.3.90/Core/AstarPath.cs:904)
AstarPath:Update() (at ./Library/PackageCache/com.arongranberg.astar@4.3.90/Core/AstarPath.cs:887)