Select your preferred scripting language. All code snippets will be displayed in this language.
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
Closeposition | Rectangle on the screen to use for the box. |
text | Text to display on the box. |
image | Texture to display on the box. |
content | Text, image and tooltip for this box. |
style | The style to use. If left out, the box style from the current GUISkin is used. |
Make a graphical box.
// Draws a box of the size of the screen. function OnGUI() { GUI.Box(Rect(0,0,Screen.width,Screen.height),"This is a title"); }
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { void OnGUI() { GUI.Box(new Rect(0, 0, Screen.width, Screen.height), "This is a title"); } }