Hi. I’m using a grid graph with the procedural mover script that follows the player. Occasionally on startup, some exceptions are thrown while trying to generate the graph, and it reaches a point in the code that should be unreachable. This causes all of my units to fail to move that are relying on the graph to be there.
The exceptions that get logged are
IndexOutOfRangeException: Index was outside the bounds of the array.
Pathfinding.ABPath.Prepare () (at Library/PackageCache/com.arongranberg.astar@4.3.45/Pathfinders/ABPath.cs:454)
Pathfinding.Path.Pathfinding.IPathInternals.Prepare () (at Library/PackageCache/com.arongranberg.astar@4.3.45/Core/Path.cs:905)
Pathfinding.PathProcessor.CalculatePathsThreaded (Pathfinding.PathHandler pathHandler) (at Library/PackageCache/com.arongranberg.astar@4.3.45/Core/Misc/PathProcessor.cs:461)
UnityEngine.Debug:LogException(Exception)
Pathfinding.PathProcessor:CalculatePathsThreaded(PathHandler) (at Library/PackageCache/com.arongranberg.astar@4.3.45/Core/Misc/PathProcessor.cs:540)
Pathfinding.<>c__DisplayClass26_0:<.ctor>b__0() (at Library/PackageCache/com.arongranberg.astar@4.3.45/Core/Misc/PathProcessor.cs:147)
System.Threading.ThreadHelper:ThreadStart()
Unhandled exception during pathfinding. Terminating.
UnityEngine.Debug:LogError (object)
Pathfinding.PathProcessor:CalculatePathsThreaded (Pathfinding.PathHandler) (at Library/PackageCache/com.arongranberg.astar@4.3.45/Core/Misc/PathProcessor.cs:541)
Pathfinding.PathProcessor/<>c__DisplayClass26_0:<.ctor>b__0 () (at Library/PackageCache/com.arongranberg.astar@4.3.45/Core/Misc/PathProcessor.cs:147)
System.Threading.ThreadHelper:ThreadStart ()
Error : This part should never be reached.
UnityEngine.Debug:LogError (object)
Pathfinding.PathProcessor:CalculatePathsThreaded (Pathfinding.PathHandler) (at Library/PackageCache/com.arongranberg.astar@4.3.45/Core/Misc/PathProcessor.cs:551)
Pathfinding.PathProcessor/<>c__DisplayClass26_0:<.ctor>b__0 () (at Library/PackageCache/com.arongranberg.astar@4.3.45/Core/Misc/PathProcessor.cs:147)
System.Threading.ThreadHelper:ThreadStart ()
Should I be handling this manually and trying to regenerate the graph if this fails? It almost seems like a timing related thing, if I move the player too quickly after the scene starts then this seems to happen.
For reference I am on 4.3.45.