Legacy Documentation: Version 5.2
LanguageEnglish
  • C#
  • JS

Script language

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

GUI.Box

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

Parameters

position 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.

Description

Make a graphical box.

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