Support Forum

Outside bounds of Array Error

When I load from my level 1 to level 2 and I have a cached recast graph on level 2, I am deleting the lvl 1 recast graph and then do an async load from 1 to 2. When level 2 loads I get this error.

IndexOutOfRangeException: Index was outside the bounds of the array.
Pathfinding.NavmeshBase.GetVertexInGraphSpace (System.Int32 index) (at Assets/AstarPathfindingProject/Generators/NavmeshBase.cs:176)
Pathfinding.TriangleMeshNode.GetVerticesInGraphSpace (Pathfinding.Int3& v0, Pathfinding.Int3& v1, Pathfinding.Int3& v2) (at Assets/AstarPathfindingProject/Generators/NodeClasses/TriangleMeshNode.cs:105)
Pathfinding.TriangleMeshNode.ContainsPointInGraphSpace (Pathfinding.Int3 p) (at Assets/AstarPathfindingProject/Generators/NodeClasses/TriangleMeshNode.cs:203)
Pathfinding.TriangleMeshNode.ContainsPoint (UnityEngine.Vector3 p) (at Assets/AstarPathfindingProject/Generators/NodeClasses/TriangleMeshNode.cs:196)
Pathfinding.RichFunnel.ClampToNavmeshInternal (UnityEngine.Vector3& position) (at Assets/AstarPathfindingProject/Core/AI/RichPath.cs:539)
Pathfinding.RichFunnel.Update (UnityEngine.Vector3 position, System.Collections.Generic.List`1[T] buffer, System.Int32 numCorners, System.Boolean& lastCorner, System.Boolean& requiresRepath) (at Assets/AstarPathfindingProject/Core/AI/RichPath.cs:491)
Pathfinding.RichAI.UpdateTarget (Pathfinding.RichFunnel fn) (at Assets/AstarPathfindingProject/Core/AI/RichAI.cs:331)
Pathfinding.RichAI.TraverseFunnel (Pathfinding.RichFunnel fn, System.Single deltaTime, UnityEngine.Vector3& nextPosition, UnityEngine.Quaternion& nextRotation) (at Assets/AstarPathfindingProject/Core/AI/RichAI.cs:376)
Pathfinding.RichAI.MovementUpdateInternal (System.Single deltaTime, UnityEngine.Vector3& nextPosition, UnityEngine.Quaternion& nextRotation) (at Assets/AstarPathfindingProject/Core/AI/RichAI.cs:361)
Pathfinding.AIBase.MovementUpdate (System.Single deltaTime, UnityEngine.Vector3& nextPosition, UnityEngine.Quaternion& nextRotation) (at Assets/AstarPathfindingProject/Core/AI/AIBase.cs:457)
Pathfinding.AIBase.FixedUpdate () (at Assets/AstarPathfindingProject/Core/AI/AIBase.cs:449)

I am currently trying to just make a new cache of my recast to see if this fixes it. Any help would be wonderful, thanks


Do you think you could post the exact code that you are using?

I am just using your recast graph. I havent changed any of your code. Would you want to remote in sometime and check it out? I was just hoping it was something simple that maybe you had seen before?

I just double checked a bunch of settings and I found one of my 40 npcs that was doing everything instead of just the recast graph. So far that error is gone, but Ill have to do a full test tomorrow evening to verify this. *I think it only happens when I load from lvl 1 to lvl 2 and I just loaded lvl 2 directly.

Still get this error. Ideas?


Sorry for the really late reply.
I still haven’t been able to replicate this. If it is possible for you to make a small test scene in which I can replicate this issue, I would love to take a look at it.
You might also try to upgrade to the beta version, a lot of bugs have been fixed in the beta (see A* Pathfinding Project).