- Home /
Question by
Maxxter · Sep 13, 2012 at 03:30 PM ·
not workingammohealth
Scavenger script woe...
I have another script that changes the clips but this one is not picking the var up. Please Help
Script I do not get any errors but it is not working :
var Gui : GameObject;
var GuiUpTime = 10;
function Update ()
{
Gui.active = false;
var other : gunscript = gameObject.GetComponent(gunscript);
if (other.Clips>=0)
{ Gui.active = true; end ();
}
}
function end ()
{ yield WaitForSeconds (GuiUpTime);
Gui.active = false; Update (); }
Comment
Answer by Sundar · Sep 13, 2012 at 03:46 PM
Try this
var Gui : GameObject;
var GuiUpTime = 10;
function Update ()
{
//Gui.active = false;
var other : gunscript = gameObject.GetComponent(gunscript);
if(other.Clips>=0)
{
Gui.active = true;
StartCoroutine( end () );
}
}
function end ()
{
yield WaitForSeconds (GuiUpTime);
Gui.active = false;
//Update ();
}
Your answer
![](https://koobas.hobune.stream/wayback/20220613081010im_/https://answers.unity.com/themes/thub/images/avi.jpg)