Legacy Documentation: Version 5.0
Language: English
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

GUI.Box

Suggest a change

Success!

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.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual
public static function Box(position: Rect, text: string): void;
public static void Box(Rect position, string text);
public static function Box(position: Rect, image: Texture): void;
public static void Box(Rect position, Texture image);
public static function Box(position: Rect, content: GUIContent): void;
public static void Box(Rect position, GUIContent content);
public static function Box(position: Rect, text: string, style: GUIStyle): void;
public static void Box(Rect position, string text, GUIStyle style);
public static function Box(position: Rect, image: Texture, style: GUIStyle): void;
public static void Box(Rect position, Texture image, GUIStyle style);
public static function Box(position: Rect, content: GUIContent, style: GUIStyle): void;
public static void Box(Rect position, GUIContent content, GUIStyle style);

Parameters

positionRectangle on the screen to use for the box.
textText to display on the box.
image Texture to display on the box.
contentText, image and tooltip for this box.
styleThe style to use. If left out, the box style from the current GUISkin is used.

Description

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"); } }