StackOverflowException in ScanAsync

Hello,

I am getting StackOverflowException while performing “AstarPath.active.ScanAsync” on two Recast Graphs. It happens only after game is built. No issue when the scan is performed in the editor.

I am not sure what I am doing wrong.

Unity Debug Exception: "StackOverflowException: The requested operation caused a stack overflow."
Unity stacktrace: "Pathfinding.Graphs.Navmesh.AABBTree`1[T].QueryNode (System.Int32 node, UnityEngine.Bounds bounds, System.Collections.Generic.List`1[T] buffer) <0x1958b449de0 + 0x0000b> in <8a1f5d85c3f84326b866761b65da5c00>:0
Pathfinding.Graphs.Navmesh.AABBTree`1[T].QueryNode (System.Int32 node, UnityEngine.Bounds bounds, System.Collections.Generic.List`1[T] buffer) (at <8a1f5d85c3f84326b866761b65da5c00>:0)
Pathfinding.Graphs.Navmesh.AABBTree`1[T].QueryNode (System.Int32 node, UnityEngine.Bounds bounds, System.Collections.Generic.List`1[T] buffer) (at <8a1f5d85c3f84326b866761b65da5c00>:0)
...
...
...
Pathfinding.Graphs.Navmesh.AABBTree`1[T].QueryNode (System.Int32 node, UnityEngine.Bounds bounds, System.Collections.Generic.List`1[T] buffer) (at <8a1f5d85c3f84326b866761b65da5c00>:0)
Pathfinding.Graphs.Navmesh.AABBTree`1[T].QueryNode (System.Int32 node, UnityEngine.Bounds bounds, System.Collections.Generic.List`1[T] buffer) (at <8a1f5d85c3f84326b866761b65da5c00>:0)
Pathfinding.Graphs.Navmesh.AABBTree`1[T].QueryNode (System.Int32 node, UnityEngine.Bounds bounds, System.Collections.Generic.List`1[T] buffer) (at <8a1f5d85c3f84326b866761b65da5c00>:0)
Pathfinding.Graphs.Navmesh.AABBTree`1[T].Query (UnityEngine.Bounds bounds, System.Collections.Generic.List`1[T] buffer) (at <8a1f5d85c3f84326b866761b65da5c00>:0)
Pathfinding.RecastMeshObj.GetAllInBounds (System.Collections.Generic.List`1[T] buffer, UnityEngine.Bounds bounds) (at <8a1f5d85c3f84326b866761b65da5c00>:0)
Pathfinding.Graphs.Navmesh.RecastMeshGatherer.CollectRecastMeshObjs () (at <8a1f5d85c3f84326b866761b65da5c00>:0)
Pathfinding.Graphs.Navmesh.TileBuilder.CollectMeshes (UnityEngine.Bounds bounds) (at <8a1f5d85c3f84326b866761b65da5c00>:0)
Pathfinding.Graphs.Navmesh.TileBuilder.Schedule (Pathfinding.Jobs.DisposeArena arena) (at <8a1f5d85c3f84326b866761b65da5c00>:0)
Pathfinding.RecastGraph+RecastGraphScanPromise+<Prepare>d__7.MoveNext () (at <8a1f5d85c3f84326b866761b65da5c00>:0)
AstarPath+<ProgressScanningIteratorsConcurrently>d__131.MoveNext () (at <8a1f5d85c3f84326b866761b65da5c00>:0)
AstarPath+<ScanInternal>d__130.MoveNext () (at <8a1f5d85c3f84326b866761b65da5c00>:0)
AstarPath+<TickAsyncScanUntilCompletion>d__128.MoveNext () (at <8a1f5d85c3f84326b866761b65da5c00>:0)

Hi

Which version of the package are you using?

Hello,

Version 5.1.6

Ok.
I haven’t been able to replicate this.
Can you replicate it in any of the example scenes?
If not, would it be possible for you to share a test project with me that shows the issue?

I will try to prepare some example project. I think I have a lot of RecastMeshObjects in scene. I am using them as static “cuts” to the RecastGraph. I have around 8000 in the scene. It is quite big scene, but I am scanning only chunk of it.

1 Like

I was investigating it a little bit more.I found out that the issue was caused probably because we accidentally put RecastMeshObj on the terain and forgot to remove it.

But I was not able to replicate it in the sample project even with this knowledge.
Anyway. This is solved. Issue was on my side, sorry.

1 Like