Check Element name from an array.

How can I check the name of an element from a game array?

For example I have the gameobject “6” and I want to check with a script atached to gameobject “6” if the name of element 5 from “activator” is “score”. If the name of element 5 is “score” to do something with the gameobject “6”.

if(gameObject.name == "x")
doSomething();

Check the image so you can understand better what I want. I want to check just one element from array not the entire object “activator”.

Thank you for answer!

for(int i = 0; i < array. Length; i ++){
If(array[i].gameobject.name == "6")
doSomething();
}
var activator : GameObjects[];

for(int i = 0; i < activator.Length i++){
        if(activator[i].name == "score"){ // Check if current index is 5
                activator[i].DoSomething(); // Do something with gameObject 6
        }
}

Sorry but I am new in programming… but I get some errors :-/
CS1002; Expecting “;” and unexpected symbol ‘.’ …

What do I have to change to make it work?

{
 
        for(int I = 0; I < array. Length; I ++){
            If(array[i].gameObject.name == "Score")
                CircleCollider2D.enabled = true;
        }

Btw if this does matter this is the script from the activator.

function Start()
{
gamearray = new GameObject[10];
InvokeRepeating("ChangeArray", Random.Range(5, 15), Random.Range(5, 15));
for(var i : float = 0; i < 10; i++)
{
    var chooseRandomly : boolean = (Random.value < 0.5);
    if(chooseRandomly == true)
   {
       gamearray[i] = score;
   }
   else
   {
       gamearray[i] = death;
   }
}
}
function ChangeArray()
{
for(var i : float = 0; i < 10; i++)
{
    var chooseRandomly : boolean = (Random.value < 0.5);
    if(chooseRandomly == true)
   {
       gamearray[i] = score;
   }
   else
   {
       gamearray[i] = death;
   }
}
}

I want to make every gameObject to check his element to get an effect something like this.

You dont need to put array.gameObject again if im not wrong since array[pos] is a game object.
javascript*_</em> <em><em>*for(var i : int = 0; i < gamearray.Length; i++){ if(gamearray[i].name == "Score"){ gamearray[i].GetComponent(CircleCollider2D).enabled = true; } }*</em></em> <em>_*
P.S What are scores and deaths? Strings ? or GameObjects?

Thank you for answers, I will test the script when I will get back at home.

1893750--121928--Help.jpg