how to locate ArgumentOutOfRangeException: error?

On editor log file I discovered that unity has an error below :

ArgumentOutOfRangeException: Argument is out of range.
Parameter name: index

It doesnt point to a specific script and line. How can i find which script is causing the error?

It’s usually caused by arrays when they are not registered as new.

Make sure to have your arrays setup like this:

public int[] myArray = new int[1000];
public GameObject[] myArrayObject = new GameObject[1000]

//The 1000 number inside of [] is for amount of spots there are in the array.

I changed all

var GObj: GameObject[];

as :

var GObj = new GObj[100];

When I press play unity editor shows no error but I am still getting the same error on editor log.

In Javascript it should look like this:

var myObject : GameObject[] = new GameObject[100];

void Start() {
}

sykoo the error still remains on editor log.

Hmm… are you sure you did this with ALL the arrays you’re using?
Bu arada, memnun oldum Özgür! :slight_smile:

there was just one left.
it was different than the others.
I changed it as well.

And it worked mate. thanks heaps.

eyvallah :slight_smile:

1 Like