Support Forum

[Error] There was an error generating the graphs

In beta 4.3.19 when scanning for Layered grid graph there are 2 errors that prevent using this graph type at all. Any chance to fix it?

There was an error generating the graphs:
System.ArgumentOutOfRangeException: Invalid JobWorkerCount 4 must be in the range 1 -> 3
Parameter name: JobWorkerCount
at Unity.Jobs.LowLevel.Unsafe.JobsUtility.set_JobWorkerCount (System.Int32 value) [0x00034] in <05f2ac9c8847426992765a22ef6d94ca>:0
at Pathfinding.LayerGridGraph.ScanInternal (System.Boolean async) [0x00001] in E:_GamesConcepts\Archers\Assets\AstarPathfindingProject\Generators\LayerGridGraphGenerator.cs:227
at Pathfinding.NavGraph.Pathfinding.IGraphInternals.ScanInternal (System.Boolean async) [0x00001] in E:_GamesConcepts\Archers\Assets\AstarPathfindingProject\Generators\Base.cs:419
at AstarPath+d__143.MoveNext () [0x000e3] in E:_GamesConcepts\Archers\Assets\AstarPathfindingProject\Core\AstarPath.cs:1846
at AstarPath+d__142.MoveNext () [0x00312] in E:_GamesConcepts\Archers\Assets\AstarPathfindingProject\Core\AstarPath.cs:1773
at Pathfinding.AstarPathEditor.MenuScan () [0x000e9] in E:_GamesConcepts\Archers\Assets\AstarPathfindingProject\Editor\AstarPathEditor.cs:1422

If you think this is a bug, please contact me on forum.arongranberg.com (post a new thread)

UnityEngine.Debug:LogError(Object)
Pathfinding.AstarPathEditor:MenuScan() (at Assets/AstarPathfindingProject/Editor/AstarPathEditor.cs:1431)
Pathfinding.AstarPathEditor:DrawSceneGUISettings() (at Assets/AstarPathfindingProject/Editor/AstarPathEditor.cs:711)
Pathfinding.AstarPathEditor:OnSceneGUI() (at Assets/AstarPathfindingProject/Editor/AstarPathEditor.cs:660)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

ArgumentOutOfRangeException: Invalid JobWorkerCount 4 must be in the range 1 -> 3
Parameter name: JobWorkerCount
Pathfinding.AstarPathEditor.MenuScan () (at Assets/AstarPathfindingProject/Editor/AstarPathEditor.cs:1433)
Pathfinding.AstarPathEditor.OnInspectorGUI () (at Assets/AstarPathfindingProject/Editor/AstarPathEditor.cs:257)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass55_0.b__0 () (at :0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

1 Like

Oops. That’s some debugging code that I accidentally left there.

Open the LayerGridGenerator.cs script and find and remove this line

Unity.Jobs.LowLevel.Unsafe.JobsUtility.JobWorkerCount = 4;

Then it should work.

Now I get:
There was an error generating the graphs:
System.ArgumentException: Results array length does not match maxHits count
at Pathfinding.Jobs.RaycastAllCommand…ctor (Unity.Collections.NativeArray1[T] commands, Unity.Collections.NativeArray1[T] results, System.Int32 maxHits, Pathfinding.Jobs.JobDependencyTracker dependencyTracker, System.Single minStep) [0x0002d] in E:_GamesConcepts\Archers\Assets\AstarPathfindingProject\Generators\Utilities\RaycastAllJob.cs:70
at Pathfinding.GridGraph+GridGraphScanData.HeightCheck (Pathfinding.GraphCollision collision, System.Int32 maxHits, Unity.Collections.NativeArray`1[T] outLayerCount, System.Single characterHeight) [0x000ef] in E:_GamesConcepts\Archers\Assets\AstarPathfindingProject\Generators\GridGenerator.cs:1338
at Pathfinding.GridGraph+d__103.MoveNext () [0x003f8] in E:_GamesConcepts\Archers\Assets\AstarPathfindingProject\Generators\GridGenerator.cs:1697
at Pathfinding.Jobs.JobHandleWithMainThreadWork+d__6.MoveNext () [0x0010a] in E:_GamesConcepts\Archers\Assets\AstarPathfindingProject\Utilities\JobDependencyTracker.cs:95
at Pathfinding.GridGraph+d__98.MoveNext () [0x00268] in E:_GamesConcepts\Archers\Assets\AstarPathfindingProject\Generators\GridGenerator.cs:1257
at Pathfinding.GridGraph+d__106.MoveNext () [0x000c6] in E:_GamesConcepts\Archers\Assets\AstarPathfindingProject\Generators\GridGenerator.cs:1805
at AstarPath+d__143.MoveNext () [0x0015f] in E:_GamesConcepts\Archers\Assets\AstarPathfindingProject\Core\AstarPath.cs:1846
at AstarPath+d__142.MoveNext () [0x00312] in E:_GamesConcepts\Archers\Assets\AstarPathfindingProject\Core\AstarPath.cs:1773
at Pathfinding.AstarPathEditor.MenuScan () [0x000e9] in E:_GamesConcepts\Archers\Assets\AstarPathfindingProject\Editor\AstarPathEditor.cs:1422

If you think this is a bug, please contact me on forum.arongranberg.com (post a new thread)

UnityEngine.Debug:LogError(Object)
Pathfinding.AstarPathEditor:MenuScan() (at Assets/AstarPathfindingProject/Editor/AstarPathEditor.cs:1431)
Pathfinding.AstarPathEditor:DrawSceneGUISettings() (at Assets/AstarPathfindingProject/Editor/AstarPathEditor.cs:711)
Pathfinding.AstarPathEditor:OnSceneGUI() (at Assets/AstarPathfindingProject/Editor/AstarPathEditor.cs:660)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

And

ArgumentException: Results array length does not match maxHits count
Pathfinding.AstarPathEditor.MenuScan () (at Assets/AstarPathfindingProject/Editor/AstarPathEditor.cs:1433)
Pathfinding.AstarPathEditor.DrawSceneGUISettings () (at Assets/AstarPathfindingProject/Editor/AstarPathEditor.cs:711)
Pathfinding.AstarPathEditor.OnSceneGUI () (at Assets/AstarPathfindingProject/Editor/AstarPathEditor.cs:660)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <437ba245d8404784b9fbab9b439ac908>:0)
UnityEditor.SceneView.CallOnSceneGUI () (at :0)
UnityEditor.SceneView.HandleSelectionAndOnSceneGUI () (at :0)
UnityEditor.SceneView.OnGUI () (at :0)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <437ba245d8404784b9fbab9b439ac908>:0)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at :0)
UnityEditor.HostView.Invoke (System.String methodName) (at :0)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at :0)
UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect) (at :0)
UnityEditor.DockArea.OldOnGUI () (at :0)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <7be1a95b44f5474c9c1a5c5fd9c86b28>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <7be1a95b44f5474c9c1a5c5fd9c86b28>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <7be1a95b44f5474c9c1a5c5fd9c86b28>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at <7be1a95b44f5474c9c1a5c5fd9c86b28>:0)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus) (at <7be1a95b44f5474c9c1a5c5fd9c86b28>:0)
UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <7be1a95b44f5474c9c1a5c5fd9c86b28>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at <7be1a95b44f5474c9c1a5c5fd9c86b28>:0)
UnityEngine.UIElements.MouseCaptureDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <7be1a95b44f5474c9c1a5c5fd9c86b28>:0)
UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at <7be1a95b44f5474c9c1a5c5fd9c86b28>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <7be1a95b44f5474c9c1a5c5fd9c86b28>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at <7be1a95b44f5474c9c1a5c5fd9c86b28>:0)
UnityEngine.UIElements.EventDispatcher.OpenGate () (at <7be1a95b44f5474c9c1a5c5fd9c86b28>:0)
UnityEngine.UIElements.EventDispatcherGate.Dispose () (at <7be1a95b44f5474c9c1a5c5fd9c86b28>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <7be1a95b44f5474c9c1a5c5fd9c86b28>:0)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at <7be1a95b44f5474c9c1a5c5fd9c86b28>:0)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at <7be1a95b44f5474c9c1a5c5fd9c86b28>:0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <7be1a95b44f5474c9c1a5c5fd9c86b28>:0)
UnityEngine.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <7be1a95b44f5474c9c1a5c5fd9c86b28>:0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <35bab3c7b0dc4999845bcfccc7758d96>:0)

You are finding a lot of bugs today. :slight_smile:
I fixed that one too and I have uploaded a new version of the package (4.3.20).
You can download the new version using the Unity Package Manager.

Thanks alot! :slight_smile: