Finding objects position in array

How can I get an object’s current position in array?

IndexOf(value)

in CS, you will need to loop through the objects to get that. A normal array does not have IndexOf.

	int IndexOf(GameObject[] array, GameObject val){
		for(int i=0; i<array.Length; i++){
			if(array[i] == val) return i;
		}
		return -1;
	}

Er, no. Do not loop through manually; just use IndexOf.

–Eric

int index = Array.IndexOf(myArray, myValue);