There was an error generating the Graphs on Scan in version 5.2.2

After upgrading to 5.2.2 when i go to scan a graph from the inspector I receive an Unreachable exception (it is a recast graph). This did not happen on the previous version. I first deleted the previous version and then installed the new one. After that happens, I get the error that Graphs cannot be added removed or serialized because they are locked. Is there something I missing in the installation process? My unity version 2023.2.16

Hi

Do you have any more information about the first exception that you get?
Reloading the scene should clear the locked state.

Below is the entire message:

There was an error generating the graphs:

System.Exception: Unreachable
  at Pathfinding.Graphs.Navmesh.TileCutter.Schedule (Pathfinding.Sync.Promise`1[T] builderOutput) [0x00150] in .\Packages\com.arongranberg.astar\Graphs\Navmesh\TileHandler.cs:229 
  at Pathfinding.RecastGraph+RecastGraphScanPromise+<Prepare>d__9.MoveNext () [0x0017d] in .\Packages\com.arongranberg.astar\Graphs\RecastGraph.cs:1064 
  at Pathfinding.GraphUpdateProcessor.PrepareGraphUpdatePromises (System.Collections.Generic.List`1[T] promises, Pathfinding.Jobs.TimeSlice timeSlice) [0x0010f] in .\Packages\com.arongranberg.astar\Core\Pathfinding\GraphUpdateProcessor.cs:244 
  at AstarPath+<ScanInternal>d__128.MoveNext () [0x0044f] in .\Packages\com.arongranberg.astar\Core\AstarPath.cs:1774 
  at AstarPath+<TickAsyncScanUntilCompletion>d__126.MoveNext () [0x00060] in .\Packages\com.arongranberg.astar\Core\AstarPath.cs:1655 
  at Pathfinding.AstarPathEditor.MenuScan () [0x0008e] in .\Packages\com.arongranberg.astar\Editor\AstarPathEditor.cs:1291 

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 ./Packages/com.arongranberg.astar/Editor/AstarPathEditor.cs:1304)
Pathfinding.AstarPathEditor/<>c__DisplayClass74_0:<RunTask>b__0 () (at ./Packages/com.arongranberg.astar/Editor/AstarPathEditor.cs:789)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()

This is the part that seems to throw the Unreachable Exception

#if UNITY_2022_3_OR_NEWER && MODULE_COLLECTIONS_2_2_0_OR_NEWER
			// Clear memory for output, so that if the job crashes for some reason, it will not contain garbage data
			var outputTileMeshesArr = new NativeArray<TileMesh.TileMeshUnsafe>(input.tileMeshes.tileMeshes.Length, Allocator.Persistent, NativeArrayOptions.ClearMemory);
			var outputTileMeshes = new TileMeshesUnsafe(outputTileMeshesArr, input.tileMeshes.tileRect, input.tileMeshes.tileWorldSize);
			var output = new TileCutterOutput {
				tileMeshes = outputTileMeshes,
			};

			TileHandler.InitDelegates();
			var handle = new JobCutTiles {
				tileVertices = tileVertices,
				tileTriangles = tileTriangles,
				tileTags = tileTags,
				cutCollection = cutCollection,
				inputTileMeshes = input.tileMeshes,
				outputTileMeshes = outputTileMeshesArr,
			}.Schedule(builderOutput.handle);

			Profiler.EndSample();
			return new Promise<TileCutterOutput>(handle, output);
#else
			throw new System.Exception("Unreachable");
#endif
		}

Hi

Thanks. Looks like I missed some error checking there.
I will include a fix in the next update.

You can also fix it by updating to the unity collections package 2.2.0 or newer.

1 Like

Hmm, after updating the collections package to 2.5.1 now there is no error thrown but at scan or when entering the game the editor gets stuck on SceneView.Repaint

Strange. If you can get me more information about that, that would be great.
Check the editor log for example.

This is probably the error

System.NullReferenceException: Object reference not set to an instance of an object
This Exception was thrown from a job compiled with Burst, which has limited exception support.
0x00007ffcf9bcb86b (Unity) MemoryProfiler::GetAllocationRoot
0x00007ffcf9fc752c (Unity) MemoryProfiler::UnregisterAllocation
0x00007ffcf9bc60f4 (Unity) MemoryManager::RegisterDeallocation
0x00007ffcf9bc7ded (Unity) MemoryManager::TryDeallocateWithLabel
0x00007ffcf9bc9753 (Unity) free_alloc_internal
0x00007ffcf95d0b32 (Unity) UnsafeUtility::Free
0x00007ffcf954bfb7 (Unity) UnsafeUtility_CUSTOM_FreeTracked
0x00007ffcf389e7b9 (7c2fb723025c7a41c10a06cbd94e4b4) Pathfinding.Graphs.Navmesh.TileCutter.DisposeTileData (at C:/dev/Unity/*****/Library/PackageCache/com.unity.burst@1.8.17/.Runtime/Packages/com.arongranberg.astar/Graphs/Navmesh/TileHandler.cs:56)
0x00007ffcf389e531 (7c2fb723025c7a41c10a06cbd94e4b4) Unity.Jobs.IJobExtensions.JobStruct`1<Pathfinding.Graphs.Navmesh.TileCutter.JobCutTiles>.Execute(ref Pathfinding.Graphs.Navmesh.TileCutter.JobCutTiles data, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, ref Unity.Jobs.LowLevel.Unsafe.JobRanges ranges, int jobIndex) -> void_1a17c9416545ae7079718413b8a5101d from UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null (at C:/dev/Unity/******/Library/PackageCache/com.unity.burst@1.8.17/.Runtime/unknown/unknown:0)
0x00007ffcf389d2dd (7c2fb723025c7a41c10a06cbd94e4b4) 21a76e848d144b130c0976e4adfb32af
0x00007ffcf9f1bf05 (Unity) ExecuteJob
0x00007ffcf9f1d250 (Unity) ForwardJobToManaged
0x00007ffcf9f1924b (Unity) ujob_execute_job
0x00007ffcf9f18681 (Unity) lane_guts
0x00007ffcf9f1b224 (Unity) worker_thread_routine
0x00007ffcfa0dbf45 (Unity) Thread::RunThreadWrapper
0x00007ffe21ad257d (KERNEL32) BaseThreadInitThunk
0x00007ffe2372af28 (ntdll) RtlUserThreadStart```

That indeed looks bad.
Can you reliably replicate this?

Can you replicate it in any example scene?

Are you using the latest version of the burst package?

I am using the latest burst package. I think I have found the culprit, but I am not 100% sure. I have a prefab that has on it a navmeshCut and navmeshAdd(on different children) it also has link2 on it. If i try to drag it into the scene the unity editor crashes. If I remove it from the scene where it already existed, the scan happens just fine. If I undo the step of deletion trying to return it back to the scene unity it again crashes

Thanks! Indeed. I accidentally allocated some data for the NavmeshAdds with the Temp allocator instead of the Persistent allocator, causing errors further down.
I’ll fix this in the next update.

2 Likes

I am running into the same issue. Is there a temporary fix for this issue?

I use NavMeshCut (and a one NavMeshAdd) on all sorts of dangerous things AI shouldn’t be walking upon. It seems removing them all allows the scene to scan, but it seems super tedious to track all the ones I remove, then re-add them once this is fixed.

I have not found a temporary solution. For me it was only in one place so i just removed the prefab from the scene. Maybe you can return to a previous version of the package by removing it and installing an older version until the next patch is up