- Home /
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
Comment
Best Answer
Answer by homeros · May 26, 2011 at 05:31 PM
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;
Your answer
Follow this Question
Related Questions
how to create a particle? 1 Answer
Unity light effect 3 Answers
Ray Light Effect 2 Answers
Objects in object pool not reactivating. 1 Answer
How do I make a gun? 1 Answer