[BUG] InvalidOperationException

  • A* version: 5.3.7 (May 06)
  • Unity version: Unity 2022.3.62f1

When I click on the “Scan” button on the AstarPath script the next playmode works fine without errors. When leaving playmode the scanned area dissapears and I get the error next time I go into playmode again (without rescanning in editor). Same problem if I use AstarPath.active.Scan() from a Script on Awake/Start/Enable.
The problem occurs in every scene, even in an empty scene with only AstarPath script active on one gameobject

ObjectDisposedException: Cannot access a disposed object.
Object name: ‘The NativeReference is already disposed.’.
Unity.Collections.NativeReference1[T].CheckNotDisposed () (at ./Library/PackageCache/com.unity.collections@1.5.1/Unity.Collections/NativeReference.cs:350) Unity.Collections.NativeReference1[T].Dispose () (at ./Library/PackageCache/com.unity.collections@1.5.1/Unity.Collections/NativeReference.cs:128)
Pathfinding.NavmeshEdges.Dispose () (at ./Packages/com.arongranberg.astar/Core/Misc/NavmeshEdges.cs:31)
Pathfinding.HierarchicalGraph.OnDisable () (at ./Packages/com.arongranberg.astar/Core/Pathfinding/HierarchicalGraph.cs:110)
AstarPath.OnDisable () (at ./Packages/com.arongranberg.astar/Core/AstarPath.cs:1348)

Also an error keeps popping up constantly on repeat:

InvalidOperationException: Cannot tick non-multithreaded pathfinding when no coroutine has been started
Pathfinding.PathProcessor.TickNonMultithreaded () (at ./Packages/com.arongranberg.astar/Core/Pathfinding/PathProcessor.cs:230)
AstarPath.Update () (at ./Packages/com.arongranberg.astar/Core/AstarPath.cs:862)

Hi

Try to upgrade to a more recent version of the unity collections package.

2 Likes