How to make GUI Text appear after a certain amount of time

Hey everyone,

I have a GUI Text for my game, but I want it to appear after a certain amount of time.
I know that I can use:

if(Time.time = 20)

But I don’t know how to actually display the GUI Text in the EXECUTE CODE section.



You can use a GUI Label, so for example:

GUI.Label(new Rect(0,0,100,100), "MyTextHere");

The first parameter is a Rect, containing the position and the size of the Label, the second is your wanted text.

If you want to use styles, you use the following code:

GUIStyle myStyle = new GUIStyle();
GUI.Label(new Rect(0,0,100,100), "MyTextHere", myStyle);

In this style you can set the font size, text color, etc

Since OnGUI() is called once per frame like the Update() method, you can do everything inside your OnGUI method.

function OnGUI()
  if(Time.time >= 20) // If more than 20 seconds has elapsed  
    GUI.Label(new Rect(10,10,100,100), "20 seconds has elapsed");