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).

Is there anyway you could remote in sometime? Im not sure I could replicate this. I started with a layered grid graph and then transitioned to a generated nav mesh and it was then that it started that during my second scene. It doesnt do it during the first scene. I have it setup to delete the first mesh before it loads the second scene to prevent errors with that.


If you could send me a zipped project where I could replicate the error, that would help immensely. Do try the beta first, though.

Ill try to work in on upgrading to the beta for my alpha 5 release. Im finishing up Alpha 4 right now. Its just a one to two time error on my level 2 that doesnt seem to hurt anything I just cant figure out what the issue is. My project folder is 325 GB right now so its just too much data to send or try to replicate. I have 5 levels right now and levels 1 3 4 and 5 do not have this error. Ill see what else I can find out when I get farther alone. Thanks!

I followed the instructions to install the beta and I got 23 scripting errors from the project. Im restoring a backup now to go back to before the beta. Suggestions?

Which errors are you getting? Note that the beta requires Unity 2020.2.2f1 or higher.

Yes Im running the latest 2021 version. Im going to try to update to the latest stable version, I see an update is out Im behind on.