- Home /
How to clear a GUI Label
Hey guys, I have got this script here:
var font : Font;
function OnGUI () {
if(Time.time > 4){
GUI.skin.label.font = font;
GUI.Label (Rect (650, 650, 300, 50), "MY TEXT");
}
}
That displays "MY TEXT" after 4 seconds.... but I want to make it so that after, say, 7 seconds, the GUI text dissapears off the screen...
How would i accomplish this???
Thanks
-Grady
Comment
Best Answer
Answer by SilverTabby · Jun 29, 2011 at 06:20 AM
Simply stop calling the GUI.Label function if the conditions to display it are no longer met.
So in this case, replace
if(Time.time > 4)
with
if(Time.time > 4 && Time.time < 7)