I/Unity (22002): IndexOutOfRangeException: Array index is out of range.
I/Unity (22002): at Pathfinding.Nodes.GridNode.FloodFill (System.Collections
.Generic.Stack`1 stack, Int32 area) [0x00008] in C:\Users\GRINAY\Documents\Other
I/Unity (22002): at AstarPath.FloodFill () [0x0018c] in C:\Users\GRINAY\Docu
I/Unity (22002): at AstarPath+c__Iterator8.MoveNext () [0x0054f] i
n C:\Users\GRINAY\Documents\Other\Assets\AstarPathfindingProject\Core\AstarPath.
I/Unity (22002): at AstarPath.Scan () [0x00011] in C:\Users\GRINAY\Documents
I/Unity (22002): at AstarPath.Awake () [0x00119] in C:\Users\GRINAY\Document
I/Unity (22002):
I/Unity (22002): (Filename: C Line: 0)

I have a error periodic. Pathfinder not work until restart application. Your help me ?

my version


I cannot check the exact code right now. But until then, could you provide the settings you use for the error to occur.
Also, just to make sure nothing has been corrupted, or old files being used. If you have upgraded the system at some point, try to delete the AstarPathfindingProject folder and import the package again.

Is my setting.

Deleting the AstarPathfindingProject folder and new importing also not resolve problem.

Is my setting.

Deleting the AstarPathfindingProject folder and new importing also not resolve problem.

This error occur after several level restarts.
I think that when AstarPath destroying(level restart) not all variables cleared and this leads an overflow.

after this error i have error in editor
There was an error generating the graphs: System.IndexOutOfRangeException: Array index is out of range. at Pathfinding.Nodes.GridNode.FloodFill (System.Collections.Generic.Stack1 stack, Int32 area) [0x00008] in C:\Users\GRINAY\Documents\Develop\Other\Assets\AstarPathfindingProject

at AstarPath.FloodFill () [0x0018c] in C:\Users\GRINAY\Documents\Develop\Other\Assets\AstarPathfindingProject\Core\AstarPath.cs:1400
at AstarPath+c__Iterator8.MoveNext () [0x0054f] in C:\Users\GRINAY\Documents\Develop\Other\Assets\AstarPathfindingProject\Core\AstarPath.cs:1561
at AstarPath.MenuScan () [0x000d7] in C:\Users\GRINAY\Documents\Develop\Other\Assets\AstarPathfindingProject\Core\AstarPath.cs:1453

If you think this is a bug, please contact me on (post a comment)

AstarPath:MenuScan() (at Assets/AstarPathfindingProject/Core/AstarPath.cs:1457)
AstarPathEditor:OnInspectorGUI() (at


I resolve this error simply added line
into OnDestroy method in AstarPath.cs;

Every time when restart level variable gridGraph increment on 2 and when is equally is 128 occure this error.

Fix it in GridNode.cs
`public static void RemoveGridGraph (GridGraph graph)
if (gridGraphs == null) {

		for (int i=0; i<gridGraphs.Length; i++) {
			if (gridGraphs [i] == graph) {
				if (gridGraphs.Length == 1) {
					gridGraphs = null;
				for (int j=i+1; j<gridGraphs.Length; j++) {
					GridGraph gg = gridGraphs [j];
					if (gg.nodes != null) {
						for (int n=0; n<gg.nodes.Length; n++) {
							if (gg.nodes [n] != null)
								((GridNode)gg.nodes [n]).SetGridIndex (j - 1);
				GridGraph[] tmp = new GridGraph[gridGraphs.Length - 1];
				for (int j=0; j<i; j++) {
					tmp [j] = gridGraphs [j];
				for (int j=i+1; j<gridGraphs.Length; j++) {
					tmp [j - 1] = gridGraphs [j];
				gridGraphs = tmp;