Support Forum

Unsafe Pointers in Unity 2021.2.0b1 Exception

Hey, just a heads up on this error on the latest beta of Unity 2021 when doing a ‘Scan’ on a graph.

There was an error generating the graphs:
System.InvalidOperationException: ManagedJob.handle.handle uses unsafe Pointers which is not allowed. Unsafe Pointers can lead to crashes and no safety against race conditions can be provided.
If you really need to use unsafe pointers, you can disable this check using [NativeDisableUnsafePtrRestriction].
  at (wrapper managed-to-native) Unity.Jobs.LowLevel.Unsafe.JobsUtility.Schedule_Injected(Unity.Jobs.LowLevel.Unsafe.JobsUtility/JobScheduleParameters&,Unity.Jobs.JobHandle&)
  at Unity.Jobs.LowLevel.Unsafe.JobsUtility.Schedule (Unity.Jobs.LowLevel.Unsafe.JobsUtility+JobScheduleParameters& parameters) [0x00000] in <6819b07865584ded95b6b8a56c57e9e2>:0 
  at Unity.Jobs.IJobExtensions.Schedule[T] (T jobData, Unity.Jobs.JobHandle dependsOn) [0x00016] in <6819b07865584ded95b6b8a56c57e9e2>:0 
  at Pathfinding.Jobs.IJobExtensions.ScheduleManaged[T] (T data, Unity.Jobs.JobHandle dependsOn) [0x00000] in F:\Unity Projects\OuterEdge\Library\PackageCache\com.arongranberg.astar@4.3.45\Utilities\JobDependencyTracker.cs:420 
  at Pathfinding.PathProcessor.AllocateNodesJob[T] (T[] result, System.Int32 count, System.Func`1[TResult] createNode) [0x00060] in F:\Unity Projects\OuterEdge\Library\PackageCache\com.arongranberg.astar@4.3.45\Core\Misc\PathProcessor.cs:378 
  at AstarPath.AllocateNodes[T] (T[] result, System.Int32 count, System.Func`1[TResult] createNode) [0x00000] in F:\Unity Projects\OuterEdge\Library\PackageCache\com.arongranberg.astar@4.3.45\Core\AstarPath.cs:1545 
  at Pathfinding.GridGraph.AllocateNodesJob (System.Int32 size, Unity.Jobs.JobHandle& dependency) [0x00007] in F:\Unity Projects\OuterEdge\Library\PackageCache\com.arongranberg.astar@4.3.45\Generators\GridGenerator.cs:594 
  at Pathfinding.GridGraph+<ScanInternalBurst>d__99.MoveNext () [0x000c4] in F:\Unity Projects\OuterEdge\Library\PackageCache\com.arongranberg.astar@4.3.45\Generators\GridGenerator.cs:1263 
  at Pathfinding.GridGraph+<ScanInternal>d__107.MoveNext () [0x0008b] in F:\Unity Projects\OuterEdge\Library\PackageCache\com.arongranberg.astar@4.3.45\Generators\GridGenerator.cs:1995 
  at AstarPath+<ScanGraph>d__145.MoveNext () [0x00124] in F:\Unity Projects\OuterEdge\Library\PackageCache\com.arongranberg.astar@4.3.45\Core\AstarPath.cs:1881 
  at AstarPath+<ScanInternal>d__144.MoveNext () [0x0024b] in F:\Unity Projects\OuterEdge\Library\PackageCache\com.arongranberg.astar@4.3.45\Core\AstarPath.cs:1808 
  at Pathfinding.AstarPathEditor.MenuScan () [0x000bc] in F:\Unity Projects\OuterEdge\Library\PackageCache\com.arongranberg.astar@4.3.45\Editor\AstarPathEditor.cs:1432 

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 Library/PackageCache/com.arongranberg.astar@4.3.45/Editor/AstarPathEditor.cs:1441)
Pathfinding.AstarPathEditor:DrawSceneGUISettings () (at Library/PackageCache/com.arongranberg.astar@4.3.45/Editor/AstarPathEditor.cs:721)
Pathfinding.AstarPathEditor:OnSceneGUI () (at Library/PackageCache/com.arongranberg.astar@4.3.45/Editor/AstarPathEditor.cs:670)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

Thanks. But yeah, I already it reported to Unity and they confirmed it as a regression.

Hehe, ok cool, thanks, will have to wait for the fix then.