enable/disable many of the same components in different GOs simultaniously?

Edit: Changed Title to match the answers.

I'm having this script, enabling or disabling a component in Update() depending on a bool.

I guess it would be better to just set it once each time the boolean changes, but as I’m still very new to this and time is running short, this appeared to be the easiest solution…

function Update () 
{
    if ( !ActivePlayerControll.waschActive)
    {
    	light.enabled = true;
    }
    else
    {
    	light.enabled = false;
    }
}

Question is, since this would be applied to quite a few GOs, is it any draining on the system? (Can't really imagine, but better save than sorry...)

Thanks & Greetz, Ky.

As you said, it would be better to just change it once. It's probably not a HUGE drain, but there shouldn't be any reason to constantly poll/set stuff in Update. I don't know what you're doing exactly, of course, but something along these lines might give you an idea:

// Disable lights in all objects tagged "Foo"
var lightObjects = GameObject.FindGameObjectsWithTag("Foo");
for (object in lightObjects)
    object.light.enabled = false;

That could still be optimized further, such as by only doing the Find once and keeping the result, and then only re-doing it if the number of objects tagged "Foo" ever changed.

I will use only one line for that:

function switchLight() { light.enabled = !ActivePlayerControll.waschActive; }

Not sure how much it costs to make setting if it does not change it it from previous state but youc ould use this code if you want to be safe.

function Update () 
{
    if (( !ActivePlayerControll.waschActive)&(light.enabled== false))
    {
        light.enabled = true;
    }
    if (( ActivePlayerControll.waschActive)&(light.enabled== true))
    {
        light.enabled = false;
    }
}