- Home /
How to make this function disable after 5seconds
Can anyone help me with this, below will display a minimap and GUI label once it is true. So how do i make it disppear after showing 5seconds. means every time if its true it will be only display for 5s
function OnGUI(){
//The world position of the ray's contact point->
if(Down == true){
GUI.Label(Rect(610,606,200,50)," X : Y : Z");
GUI.Label(Rect(610,620,200,50),hitPos+ "") ;
minimap1.enabled = true;
minimap1.pixelRect = Rect(750,150,350,120);
}
}
Comment
Best Answer
Answer by syclamoth · Jan 31, 2012 at 03:26 AM
Instead of just setting Down to true, call this function-
function ActivateMinimapForSeconds(seconds : float)
{
minimap1.enabled = true;
Down = true;
yield WaitForSeconds(seconds);
minimap1.enabled = false;
Down = false;
}
how do i call this function
i try> Activate$$anonymous$$inimapForSeconds(); or Activate$$anonymous$$inimapForSeconds; all cannot,
o i know already Thx >Activate$$anonymous$$inimapForSeconds(5);
syclamoth,it work once i click it display for 5s. but why i also have to wait for 5s in order to click again?