A* no longer able to scan navmesh

Hi folks - primarily @aron_granberg if you’re back, hope you had a good break!

I’m on the latest beta of A*, and I can no longer scan any navmesh models. The error below occurs, as well as some ‘key already exists’ errors sometimes. I’m not sure how the error started, but I can no longer scan a navmesh for models that previously worked just fine. Though I’m not currently getting the issue, I’ve seen Burst pop up as a problem as well. I seem to only be getting a bunch of the below issues when I try recently. I’ve been trying this on various versions of Unity URP 2022.2 . I’ve tried reinstalling A*, trying things in a different project, switching Unity versions, nothing seems to work! Would really love some insight on how to fix this. Also worth noting, Have tried going back to the regular pro version of A* and still not been able to get things working properly. But the beta has some great features that really benefit my game, so I’m keen to get it working again for my project.

Thanks for any and all help!

IndexOutOfRangeException: Index was outside the bounds of the array.
Pathfinding.NavmeshBase.GetVertex (System.Int32 index) (at ./Library/PackageCache/com.arongranberg.astar@4.3.66/Generators/NavmeshBase.cs:179)
Pathfinding.TriangleMeshNode.GetVertices (Pathfinding.Int3& v0, Pathfinding.Int3& v1, Pathfinding.Int3& v2) (at ./Library/PackageCache/com.arongranberg.astar@4.3.66/Generators/NodeClasses/TriangleMeshNode.cs:107)
Pathfinding.NavmeshEdges+JobCalculateObstacles.CalculateBoundingBox (Pathfinding.HierarchicalGraph hGraph, System.Int32 hierarchicalNode) (at ./Library/PackageCache/com.arongranberg.astar@4.3.66/Core/Misc/NavmeshEdges.cs:140)
Pathfinding.NavmeshEdges+JobCalculateObstacles.Execute (System.Int32 startIndex, System.Int32 count) (at ./Library/PackageCache/com.arongranberg.astar@4.3.66/Core/Misc/NavmeshEdges.cs:118)
Unity.Jobs.IJobParallelForBatchExtensions+JobParallelForBatchProducer`1[T].Execute (T& jobData, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at ./Library/PackageCache/com.unity.collections@2.1.0-pre.11/Unity.Collections/Jobs/IJobParallelForBatch.cs:56)

Tried on another machine as well, and got some of the previous errors I was talking about.

System.ArgumentException: An item with the same key has already been added
This Exception was thrown from a job compiled with Burst, which has limited exception support.
0x00007ffcc2e77be0 (f1627cebf014767afd380767458431e) Unity.Jobs.IJobExtensions.JobStruct`1<Pathfinding.NavmeshBase.CalculateNodeConnectionsJob>.Execute(ref Pathfinding.NavmeshBase.CalculateNodeConnectionsJob data, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, ref Unity.Jobs.LowLevel.Unsafe.JobRanges ranges, int jobIndex) -> void_73c04fea4d034adcf3d7ccb459d2c985 from UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null (at C:/Users/Tyler/Perforce/tyler_TYARCADE_BeatTraveller_666/RezV6/Library/PackageCache/com.unity.burst@1.8.4/.Runtime/unknown/unknown:0)
0x00007ffcc2e75ed6 (f1627cebf014767afd380767458431e) 560f9cc772229026df79dab969f99963
0x00007ff7c2a3ca9c (Unity) ExecuteJob
0x00007ff7c2a3dddb (Unity) ForwardJobToManaged
0x00007ff7c2a3a0b4 (Unity) ujob_execute_job
0x00007ff7c2a39744 (Unity) lane_guts
0x00007ff7c2a3bc44 (Unity) worker_thread_routine
0x00007ff7c2c60c17 (Unity) Thread::RunThreadWrapper
0x00007ffceb0a7604 (KERNEL32) BaseThreadInitThunk
0x00007ffcebe426a1 (ntdll) RtlUserThreadStart

ArgumentException: Requested value outside bounds of UnsafeAppendOnlyBuffer. Remaining bytes: 0 Requested: 4
Unity.Collections.LowLevel.Unsafe.UnsafeAppendBuffer+Reader.CheckBounds (System.Int32 structSize) (at ./Library/PackageCache/com.unity.collections@2.1.0-pre.11/Unity.Collections/UnsafeAppendBuffer.cs:425)
Unity.Collections.LowLevel.Unsafe.UnsafeAppendBuffer+Reader.ReadNext[T] () (at ./Library/PackageCache/com.unity.collections@2.1.0-pre.11/Unity.Collections/UnsafeAppendBuffer.cs:359)
Pathfinding.NavmeshBase+ApplyNodeConnectionsJob.Apply (Pathfinding.TriangleMeshNode[] nodes, Pathfinding.NavmeshBase+CalculateNodeConnectionsJob+TileNodeConnectionsUnsafe connections) (at ./Library/PackageCache/com.arongranberg.astar@4.3.66/Generators/NavmeshBase.cs:821)
Pathfinding.NavmeshBase+ApplyNodeConnectionsJob.Execute () (at ./Library/PackageCache/com.arongranberg.astar@4.3.66/Generators/NavmeshBase.cs:808)
Unity.Jobs.IJobExtensions+JobStruct`1[T].Execute (T& data, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at <b0fc6facff52490f8c5788181f70c5cc>:0)

IndexOutOfRangeException: Index was outside the bounds of the array.
Pathfinding.NavmeshBase.GetVertex (System.Int32 index) (at ./Library/PackageCache/com.arongranberg.astar@4.3.66/Generators/NavmeshBase.cs:179)
Pathfinding.TriangleMeshNode.GetVertices (Pathfinding.Int3& v0, Pathfinding.Int3& v1, Pathfinding.Int3& v2) (at ./Library/PackageCache/com.arongranberg.astar@4.3.66/Generators/NodeClasses/TriangleMeshNode.cs:106)
Pathfinding.NavmeshEdges+JobCalculateObstacles.CalculateBoundingBox (Pathfinding.HierarchicalGraph hGraph, System.Int32 hierarchicalNode) (at ./Library/PackageCache/com.arongranberg.astar@4.3.66/Core/Misc/NavmeshEdges.cs:140)
Pathfinding.NavmeshEdges+JobCalculateObstacles.Execute (System.Int32 startIndex, System.Int32 count) (at ./Library/PackageCache/com.arongranberg.astar@4.3.66/Core/Misc/NavmeshEdges.cs:118)
Unity.Jobs.IJobParallelForBatchExtensions+JobParallelForBatchProducer`1[T].Execute (T& jobData, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at ./Library/PackageCache/com.unity.collections@2.1.0-pre.11/Unity.Collections/Jobs/IJobParallelForBatch.cs:56)

The error above just keeps happening continuosly in the project

FYI I have moved back to version 61 of the beta and things are now working. If you’re having these types of problems, I encourage folks to stick with 61!

Hi

I think this has been fixed in beta 4.3.67 which was just released.

1 Like

I have the latest beta installed having the same issue (4.3.84 · October 31, 2023)

IndexOutOfRangeException: Index was outside the bounds of the array.
Pathfinding.NavmeshBase.GetVertex (System.Int32 index) (at ./Library/PackageCache/com.arongranberg.astar@4.3.84/Graphs/NavmeshBase.cs:183)
Pathfinding.TriangleMeshNode.GetVertices (Pathfinding.Int3& v0, Pathfinding.Int3& v1, Pathfinding.Int3& v2) (at ./Library/PackageCache/com.arongranberg.astar@4.3.84/Graphs/Nodes/TriangleMeshNode.cs:118)
Pathfinding.NavmeshEdges+JobCalculateObstacles.CalculateBoundingBox (Pathfinding.HierarchicalGraph hGraph, System.Int32 hierarchicalNode) (at ./Library/PackageCache/com.arongranberg.astar@4.3.84/Core/Misc/NavmeshEdges.cs:179)
Pathfinding.NavmeshEdges+JobCalculateObstacles.Execute (System.Int32 startIndex, System.Int32 count) (at ./Library/PackageCache/com.arongranberg.astar@4.3.84/Core/Misc/NavmeshEdges.cs:156)
Unity.Jobs.IJobParallelForBatchExtensions+JobParallelForBatchProducer`1[T].Execute (T& jobData, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at ./Library/PackageCache/com.unity.collections@2.1.0-pre.11/Unity.Collections/Jobs/IJobParallelForBatch.cs:56)

Same issue on 4.3.84, i tested and found the 4.3.75 works fine, not working since 4.3.76.

Hi

Do you have any way of consistently replicating this?
Can you replicate it in a new scene?

I might, I solved it for now by enabling tiling, but if you want a scene I could maybe export one, edit: exporting the scene is a bit hard for me to do atm :expressionless: since it contains a lot of scripts and prefabs.

This is my testing mesh: WeTransfer - Send Large Files & Share Photos Online - Up to 2GB Free

The reproduce was pretty simple:

  1. Create an empty gameobject and assign PathFinder component
  2. Create a navmesh graph and assign this mesh into Source Mesh
  3. Scan and check the console error log

Rollback to 4.3.75 and do the same steps, it comes without error log.

@Venturely

It looks like your mesh contained a lot of degenerate triangles.
This caused some issues. I have changed the code now so that it logs a warning and removes those triangles instead.
However, you should still fix your mesh so that it doesn’t contain degenerate triangles.

Thank you for fixting this! (yep, will remove those degenerate triangles, but we found that Recast graph also works well, so maybe we don’t need to manually generate the navmesh in our script)