private var isCurrent : boolean = false;
private var isActive : boolean = false;
var weaponNumber : int = 0;
function Update () {
if(transform.parent.GetComponent(CamControl_SP).current_weapon == weaponNumber)
{
isCurrent = true;
}
else
{
isCurrent = false;
}
if(isCurrent == true isActive == false)
{
Arm();
gameObject.SetActiveRecursively(true);
}
else if(isCurrent == false isActive == true)
{
isActive = false;
gameObject.SetActiveRecursively(false);
}
}
function Arm () {
isActive = true;
animation.Play ("arm");
}
I’m trying to get my weapons to appear when they are selected and disappear if they are not. The above code works, but only once, than my weapons disappear permanently. Why is this happening?