How to find an object in an array?

Hi I have a gameObject variable and I have a gameObject array how do I find what nimber the gameObject is an the array?

e.g.

var objectArray : GameObject[];
var object : GameObject;

function Start(){
	//find the objects number in the array
}

I would personally do something like this.


int i;
int MyNumber;
i = -69;
for(i=0; i<objectArray.length;i++)
{
    if(objectArray *== object)*

{
MyNumber = i;
break;
}
}
if ( i == -69 ) Debug.Log(“ALERT. TOTAL FAILURE.”);
else Debug.Log("the matching item is index number " +i);
-----------
This is in C# but should not be to hard to convert it :slight_smile: Ofc there is probably a better way