Action on multiple elements

Hi to all,

i need a function that applies the same operation to multiple elements (imagine a list of 20 gameObjects that must be deactivated)… i know it’s simple but i’m new to JScript!

Unity reference is only about Unity-specific classes, enumerators and attributes, but nothing about basic JScript sintax (for instance: how to make if/else conditions). Does anybody have any suggestion about a valid JS-sintax help website?

Thanks

if your gameobjects are all parented by one you just have to call the parent with SetActiveRecursively(false). But to understand the syntax and how code is organized in Unity I suggest to do the Lerpz tutorial (I think it`s called first person tutorial or something like this).

You probably need to post more details so we can help. For example, why not use a BroadcastMessage() ?

Probably i dont explain correctly my problem…
In one single script i need to apply an action over multiple items, something similar to this:

for item in list(GameObj01, GameObj02, GameObj03){
item.active = false;
}

…i use Director and Lingo can do that…

C#:

foreach(GameObject child in myArray)
{
    child.active = false;

}

in java Script I think it`s very similar, something like this:

for(child : GameObject in myArray)
{
    child.active = false;

}

so both is very close to your Lingo example.