Unity – Scripting – OnGUI – Box

Videogames Development – Unity – Code GUI Objects – Box

Input Text Area

1. Assign the script to the Camera:

#pragma strict
     
    // Draws a box of the size of the screen.
    var stringBox : String = "Hello World\nI've got 2 lines...";
	function OnGUI() {
		 GUI.Box(Rect(0,0,Screen.width,Screen.height),"This is a title");
	}

Statement:
GUI.Box(Rect(0,0,Screen.width,Screen.height),”This is a title”);
GUI.Box(Rectangle(x,y,x,y),text content);