Okay, I made a checkpoint object and I want to display text right after the player collides with it. Now I have trided various ways to do this, but the closest things that have happened is that I have implemented GUIText to show an image with a message drawn on it. Now all I need is a way to make that message disappear after 2 seconds. Can anyone helpe me?
var yourGUItext : GUIText;
function ShowGUIText()
{
yourGUItext.enabled = true;
StopCoroutine("HideGUIText");
StartCoroutine("HideGUIText");
}
function HideGUIText()
{
yield WaitForSeconds(2);
yourGUItext.enabled = false;
}
ShowGUIText() is the function you should call to show the guitext. You can just place the content of the function in the place you currently display it.
yourGUItext needed a reference to the GameObject on which you have the guitext you are displaying.
//coloque :
yourGUItext.guiText.enabled = false;
//ou (or):
Destroy(yourGUItext);