Error Generating Graphs with RecastNavMesh (3.3.5 Beta)

Hi Aron,

I tried the 3.3.5 Beta to generate a RecastNavMesh on a simple scene with a only a terrain and a Sketchup skyscraper model (rather complex :slight_smile: ) in it.

After pressing the “scan” button, I receive a “Error Generating Mesh” error box. In the console there are a lot of “Exception: Noes, overflow at 184832 (23104)” Errors.

Here’s an excerpt of the logfile:


Unloading 505 unused Assets to reduce memory usage. Loaded Objects now: 1539.
Total: 7.778843 ms (FindLiveObjects: 0.076578 ms CreateObjectMapping: 0.027766 ms MarkObjects: 2.028450 ms DeleteObjects: 1.301832 ms)

Collecting Meshes

Generating Tile #0 of 56
…
Generating Tile #17 of 56

Generating Tile #18 of 56

There was an error generating the graphs:
System.Exception: Noes, overflow at 184832 (23104)

at Pathfinding.Voxels.VoxelArea.AddLinkedSpan (Int32 index, UInt32 bottom, UInt32 top, Int32 area, Int32 voxelWalkableClimb) [0x00275] in E:\Projekte\Unity3D\temp_3_3_5_test\Assets\AstarPathfindingProject\Generators\Utilities\Voxels\VoxelClasses.cs:444

at Pathfinding.Voxels.Voxelize.VoxelizeInput () [0x00510] in E:\Projekte\Unity3D\temp_3_3_5_test\Assets\AstarPathfindingProject\Generators\Utilities\Voxels\VoxelRasterization.cs:346

at Pathfinding.RecastGraph.BuildTileMesh (Pathfinding.Voxels.Voxelize vox, Int32 x, Int32 z) [0x0010c] in E:\Projekte\Unity3D\temp_3_3_5_test\Assets\AstarPathfindingProject\Generators\RecastGenerator.cs:1254

at Pathfinding.RecastGraph.ScanAllTiles (.OnScanStatus statusCallback) [0x001d2] in E:\Projekte\Unity3D\temp_3_3_5_test\Assets\AstarPathfindingProject\Generators\RecastGenerator.cs:1184

at Pathfinding.RecastGraph.ScanTiledNavmesh (.OnScanStatus statusCallback) [0x00000] in E:\Projekte\Unity3D\temp_3_3_5_test\Assets\AstarPathfindingProject\Generators\RecastGenerator.cs:1122

at Pathfinding.RecastGraph.Scan (.OnScanStatus statusCallback) [0x00043] in E:\Projekte\Unity3D\temp_3_3_5_test\Assets\AstarPathfindingProject\Generators\RecastGenerator.cs:982

at AstarPath.ScanLoop (.OnScanStatus statusCallback) [0x0030d] in E:\Projekte\Unity3D\temp_3_3_5_test\Assets\AstarPathfindingProject\Core\AstarPath.cs:1816

at AstarPath.MenuScan () [0x000c1] in E:\Projekte\Unity3D\temp_3_3_5_test\Assets\AstarPathfindingProject\Core\AstarPath.cs:1708

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

UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:LogError(Object)
AstarPath:MenuScan() (at Assets\AstarPathfindingProject\Core\AstarPath.cs:1711)
AstarPathEditor:OnInspectorGUI() (at Assets\AstarPathfindingProject\Editor\AstarPathEditor.cs:428)
UnityEditor.InspectorWindow:DrawEditors(Boolean, Editor[], Boolean) (at C:\BuildAgent\work\cac08d8a5e25d4cb\Editor\Mono\Inspector\InspectorWindow.cs:888)
UnityEditor.InspectorWindow:OnGUI() (at C:\BuildAgent\work\cac08d8a5e25d4cb\Editor\Mono\Inspector\InspectorWindow.cs:266)
System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&)
System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo) (at /Applications/buildAgent/work/b59ae78cff80e584/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
System.Reflection.MethodBase:Invoke(Object, Object[]) (at /Applications/buildAgent/work/b59ae78cff80e584/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.HostView:Invoke(String, Object) (at C:\BuildAgent\work\cac08d8a5e25d4cb\Editor\Mono\GUI\DockArea.cs:234)
UnityEditor.HostView:Invoke(String) (at C:\BuildAgent\work\cac08d8a5e25d4cb\Editor\Mono\GUI\DockArea.cs:227)
UnityEditor.DockArea:OnGUI() (at C:\BuildAgent\work\cac08d8a5e25d4cb\Editor\Mono\GUI\DockArea.cs:661)

(Filename: Assets/AstarPathfindingProject/Core/AstarPath.cs Line: 1711)

Exception: Noes, overflow at 184832 (23104)
at Pathfinding.Voxels.VoxelArea.AddLinkedSpan (Int32 index, UInt32 bottom, UInt32 top, Int32 area, Int32 voxelWalkableClimb) [0x00275] in E:\Projekte\Unity3D\temp_3_3_5_test\Assets\AstarPathfindingProject\Generators\Utilities\Voxels\VoxelClasses.cs:444

at Pathfinding.Voxels.Voxelize.VoxelizeInput () [0x00510] in E:\Projekte\Unity3D\temp_3_3_5_test\Assets\AstarPathfindingProject\Generators\Utilities\Voxels\VoxelRasterization.cs:346

at Pathfinding.RecastGraph.BuildTileMesh (Pathfinding.Voxels.Voxelize vox, Int32 x, Int32 z) [0x0010c] in E:\Projekte\Unity3D\temp_3_3_5_test\Assets\AstarPathfindingProject\Generators\RecastGenerator.cs:1254

at Pathfinding.RecastGraph.ScanAllTiles (.OnScanStatus statusCallback) [0x001d2] in E:\Projekte\Unity3D\temp_3_3_5_test\Assets\AstarPathfindingProject\Generators\RecastGenerator.cs:1184

at Pathfinding.RecastGraph.ScanTiledNavmesh (.OnScanStatus statusCallback) [0x00000] in E:\Projekte\Unity3D\temp_3_3_5_test\Assets\AstarPathfindingProject\Generators\RecastGenerator.cs:1122

at Pathfinding.RecastGraph.Scan (.OnScanStatus statusCallback) [0x00043] in E:\Projekte\Unity3D\temp_3_3_5_test\Assets\AstarPathfindingProject\Generators\RecastGenerator.cs:982

at AstarPath.ScanLoop (.OnScanStatus statusCallback) [0x0030d] in E:\Projekte\Unity3D\temp_3_3_5_test\Assets\AstarPathfindingProject\Core\AstarPath.cs:1816

at AstarPath.MenuScan () [0x000c1] in E:\Projekte\Unity3D\temp_3_3_5_test\Assets\AstarPathfindingProject\Core\AstarPath.cs:1708
UnityEngine.Debug:Internal_LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
UnityEditor.InspectorWindow:DrawEditors(Boolean, Editor[], Boolean) (at C:\BuildAgent\work\cac08d8a5e25d4cb\Editor\Mono\Inspector\InspectorWindow.cs:895)
UnityEditor.InspectorWindow:OnGUI() (at C:\BuildAgent\work\cac08d8a5e25d4cb\Editor\Mono\Inspector\InspectorWindow.cs:266)
System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&)
System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo) (at /Applications/buildAgent/work/b59ae78cff80e584/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
System.Reflection.MethodBase:Invoke(Object, Object[]) (at /Applications/buildAgent/work/b59ae78cff80e584/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.HostView:Invoke(String, Object) (at C:\BuildAgent\work\cac08d8a5e25d4cb\Editor\Mono\GUI\DockArea.cs:234)
UnityEditor.HostView:Invoke(String) (at C:\BuildAgent\work\cac08d8a5e25d4cb\Editor\Mono\GUI\DockArea.cs:227)
UnityEditor.DockArea:OnGUI() (at C:\BuildAgent\work\cac08d8a5e25d4cb\Editor\Mono\GUI\DockArea.cs:661)

(Filename: Assets/AstarPathfindingProject/Generators/Utilities/Voxels/VoxelClasses.cs Line: 444)

NullReferenceException: Object reference not set to an instance of an object
at Pathfinding.TriangleMeshNode.GetVertex (Int32 i) [0x00000] in E:\Projekte\Unity3D\temp_3_3_5_test\Assets\AstarPathfindingProject\Generators\odeClasses\TriangleMeshNode.cs:79
.

Regards,

Josef

I had to abbreviate the log cause it was to long for the Forum Software.

Hm…

I “solved” it by increasing the Cell Size (RecastGraph) from 0.2 to 0.3. Know it works. If I decrease the Cell Size to 0.2 again, it throws the error message to me again.

Greetings,

Josef

Ouch. Something I had forgot to fix.

Right now it uses an estimate on how many layers there will be in the scene. The estimate is set at an average of 8 layers (that would mean 4 floors in a building since both roof and floor is counted as a layer).

Here is a fix I think will work, I haven’t tested it even for compiler errors, but hopefully it will work:

Replace the line throwing the exception (around line 444 in VoxelClasses.cs) with
LinkedVoxelSpan[] tmp = linkedSpans; int count = linkedSpanCount; int popped removedStackCount; linkedSpans = new LinkedVoxelSpan[linkedSpans.Length*2]; ResetLinkedVoxelSpans(); linkedSpanCount = count; removedStackCount = popped; for (int i=0;i<linkedSpanCount;i++) { linkedSpans[i] = tmp[i]; } Debug.LogWarning ("Layer estimate too low, doubling size of buffer.");

In case it doesn’t work, you can open the Optimizations tab in the A* Inspector and disable ASTAR_RECAST_ARRAY_BASED_LINKED_LIST, it will use a different data structure for holding the voxels, a bit slower and has a much higher penalty on the GC, but it works.

Thanks for the quick answer.

Cool. Not it works also with Cell size of 0.2 :slight_smile:

There’s a “=” missing in

int popped removedStackCount

Thanks. You’re my hero :smiley:

:smiley: