I have a projectile, and I want to label its position at various points, but I only want that lable to last for a couple of seconds and then go up in a poof of smoke.
I tried a while loop with Time.time <= startTime + 2, but this just caused Unity to freeze.
Mike mentioned a co-function, but I'm not sure how to go about that.
Thx
I'll just copy paste my other answer which should work:
change this
if (GUI.Button (Rect (20,40,80,20), "Level 1"))
{
print( "you hit LoadLevel (1), but this does nothing yet");
test = true;
timeWhenPushed = Time.time;
print ("You pushed the button at " + timeWhenPushed);
while (Time.time <= timeWhenPushed +1)
{
GUI.Label(Rect (120, 40, 200, 40), "You hit level 1");
}
}
to this:
if (GUI.Button (Rect (20,40,80,20), "Level 1"))
{
print( "you hit LoadLevel (1), but this does nothing yet");
test = true;
timeWhenPushed = Time.time;
print ("You pushed the button at " + timeWhenPushed);
}
if (Time.time <= timeWhenPushed +1)
{
GUI.Label(Rect (120, 40, 200, 40), "You hit level 1");
}