- Home /
Drawing GUI Text using Javascript
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?
Answer by GuyTidhar · Apr 04, 2012 at 02:44 PM
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.
Answer by ColdFredLima · Jul 01, 2013 at 12:58 PM
//coloque :
yourGUItext.guiText.enabled = false;
//ou (or):
Destroy(yourGUItext);
Your answer
Follow this Question
Related Questions
C# GUI Button 2 Answers
3D ^ Custom GUIText/Label or Making a Score System without using GUI? 0 Answers
Cant find specific GUI Object thing 1 Answer
How can I display text onscreen dynamically? 2 Answers
Changing 3d text through script 1 Answer