Search code examples
user-interfaceunity-game-engineunityscript

New to Unity, GUI simply not showing up


I'm very new to Unity, sorry if the question is too stupid, but all the information about GUI on Google focuses on the codes inside OnGUI() rather than the pre-setup.

The thing is, I created a project, created a javascript script with very simple code. That's all.

#pragma strict

function Start () {

}


function Update () {

}

function OnGUI () {
        GUI.Box(Rect(0,0,Screen.width,Screen.height),"This is a Box");
        GUI.Label (Rect (10, 10, 100, 20), "Hello World!"); 
}

After hitting Play button just nothing there.


Solution

  • You have to include that script to your scene camera[MainCamera]. Then it'll show ....