Hello there!
In our game, we arbitrarily generate and destroy GridGraph
s, up to as many as nine at a time. Back in version 3.8.1, there weren’t any problems with it, but when we updated to 3.8.6, we started getting these issues:
IndexOutOfRangeException: Array index is out of range.
Pathfinding.PathHandler.GetPathNode (Pathfinding.GraphNode node) (at Assets/Plugins/AstarPathfindingProject/Core/PathHandler.cs:272)
Pathfinding.ABPath.Initialize () (at Assets/Plugins/AstarPathfindingProject/Pathfinders/ABPath.cs:270)
AstarPath+<CalculatePaths>c__Iterator2.MoveNext () (at Assets/Plugins/AstarPathfindingProject/Core/AstarPath.cs:2707)
AstarPath.Update () (at Assets/Plugins/AstarPathfindingProject/Core/AstarPath.cs:906)
UnityEngine.Debug:LogException(Exception)
AstarPath:Update() (at Assets/Plugins/AstarPathfindingProject/Core/AstarPath.cs:913)
Consequently, the there will be an exception at:
Unhandled exception during pathfinding. Terminating.
UnityEngine.Debug:LogError(Object)
AstarPath:Update() (at Assets/Plugins/AstarPathfindingProject/Core/AstarPath.cs:914)
The error manifests randomly. Sometimes creating/destroying GridGraph
s would work fine, and RVOController
s can use them almost immediately.But you can usually get it after three or four tries.
This also breaks the OnDrawGizmos()
method of AstarPath
, which I have promptly commented out.
What seems to be the problem and how can this be fixed? Thank you!