Casting error on multiple emitters

function Start()
{
    var emitters : ParticleEmitter[];
    emitters = GetComponentsInChildren(ParticleEmitter);
    for (var emitter: ParticleEmitter in emitters) 
    {
        emitter.emit = false;
    }    
}

I am trying to turn a set of emitters on and off. When I use this script I get "Cannot cast from source type to destination type."

GetComponentsInChildren returns a Component[], so you need to get them as that, then cast each to ParticleEmitter, e.g.

var emitters: Component[];
emitters = GetComponentsInChildren(ParticleEmitter);
for( var comp : Component in emitters )
{
  ParticleEmitter emitter = (ParticleEmitter)comp;
  emitter.emit = false;
}

function Start()
{

    var emitters : ParticleEmitter[];
    emitters = GetComponentsInChildren(ParticleEmitter);

    for (var emitter: ParticleEmitter in emitters)
    { 
        emitter.emit = false;
    } 

}

Rather .emit, use .enable maybe, but I'm mostly just cleaning up your code and putting it in tags...

I ended up fixing this by targeting the individual game objects instead of trying to target them as a group using the for loop. I still don't understand why I can't target them as components in children