unity3d - Unityscript transfer boolean value between functions -
i'm having bit of trouble unityscript.
what want have gui message appear when objects touched (then vanish after time). think have worked out, message trips automatically.
my attempted solution have conditional part of gui message allows appear when boolean true. in different script tripped when object touched, boolean set true, script can run, , reset boolean false.
however i'm getting "you can call gui functions inside ongui. i'm not sure means.
message code:
youdied.js static var deathmessageshow : boolean = false; function ongui() { if(deathmessageshow == true){ if(time.time >= 5 ) gui.box(rect(200,300,275,150),"you died"); } deathmessageshow = false; }
other code (truncated):
dead.js function ontriggerenter() { //code resets environment youdied.deathmessageshow = true; }
any suggestions on going on, or better solution appreciated.
the following code show gui message 5 seconds hides it:
youdied.js static var deathmessageshow : boolean = false; function ongui() { if(deathmessageshow) { gui.box(rect(200,300,275,150),"you died"); // call function hidedeathmessage() after 5 seconds invoke("hidedeathmessage", 5.0f); } } function hidedeathmessage() { deathmessageshow = false; }
other code:
dead.js function ontriggerenter() { //code resets environment youdied.deathmessageshow = true; }
Comments
Post a Comment