Want to make appear and disappear a Light and a Particle Emiter

Hi,
I have done a little script, to code a little effect of light and particles when my characters attack. Here you have:

//variables
public var efecto : Transform;
public var luz : Transform;

//on the code
    while (true)
	{
		var isAttacking = playerController.IsAttacking ();
		
		if (isAttacking){
			efecto.active=true;
			luz.active=true;
		}
		else{
			efecto.active =false;
			luz.active=false;
		}
		yield;
	}

But when I use this method I have a problem, Unity returns me this error:

Assets/Scripts/Player/AttackEffectController.js(17,29): BCW0012: WARNING: 'UnityEngine.Component.active' is obsolete. the active property is deprecated on components. Please use gameObject.active instead. If you meant to enable / disable a single component use enabled instead.

What I can do? Lot of thanks in advance

This should be warning, not an error but to solve this you can either use

efecto.gameObject.active = true;
luz.gameObject.active = true;

or

efecto.enabled = true;
luz.enabled = true;