Professional Documents
Culture Documents
## MonoBehaviour.OnGUI function OnGUI () : void OnGUI is called for rendering and handling GUI events.
Description
OnGUI is called for rendering and handling GUI events. This means that your OnGUI implementation might be called several times per frame (one call per event). For more information on GUI events see the Event reference. If the MonoBehaviour's enabled property is set to false, OnGUI() will not be called.
function OnGUI () { if (GUI.Button (Rect (10,10,150,100), "I am a button")) print ("You clicked the button!"); }
## GUI.Box static function Box (position : Rect, text : string) : void static function Box (position : Rect, image : Texture) : void static function Box (position : Rect, content : GUIContent) : void static function Box (position : Rect, text : string, style : GUIStyle) : void static function Box (position : Rect, image : Texture, style : GUIStyle) : void static function Box (position : Rect, content : GUIContent, style : GUIStyle) : void Make a graphical box.
GUI.Box
static function Box(position: Rect, text: string): void; static function Box(position: Rect, image: Texture): void; static function Box(position: Rect, content: GUIContent): void; static function Box(position: Rect, text: string, style: GUIStyle): void; static function Box(position: Rect, image: Texture, style: GUIStyle): void; static function Box(position: Rect, content: GUIContent, style: GUIStyle): void; Parameters
position text
image Texture to display on the box. content style Text, image and tooltip for this box. The style to use. If left out, the box style from the current GUISkin is used.
Description
// Draws a box of the size of the screen. function OnGUI() { GUI.Box(Rect(0,0,Screen.width,Screen.height),"This is a title"); }
## Screen.width
static var width : int The current width of the screen window in pixels (Read Only).
The current width of the screen window in pixels (Read Only). This is the actual width of the player window (in fullscreen it is also the current resolution).