Array question....

When you have an array of gameobjects, how can do something to all of them at once? That might not make sense, but something like this

var Objects : GameObject;

(if condition==true){Objects.active=true;}

for (int i = 0; i < Objects.Length; i++){
     if (condition == true){
          Objects[i].active = true;
     }
}

or

foreach (GameObject go in Objects){
     if (condition == true){
          go.active = true;
     }
}

Not 100% sure how it would convert to UnityScript, buy the syntax should be almost identical I’d imagine.

use a foreach loop

 foreach (GameObject value in Objects) {
     value.enabled = true;
}

Name your variables in camelCase and more clearly*.

for (var gameObject in gameObjects) gameObject.active = condition;
  • gameObject could be clearer, because it looks too much like you’re trying to do this.gameObject.active, to me. So just use a better name for the array, to begin with.