GUILayout.BeginArea Manual     Reference     Scripting  
Scripting > Runtime Classes > GUILayout
GUILayout.BeginArea

static function BeginArea (screenRect : Rect) : void

static function BeginArea (screenRect : Rect, text : string) : void

static function BeginArea (screenRect : Rect, image : Texture) : void

static function BeginArea (screenRect : Rect, content : GUIContent) : void

static function BeginArea (screenRect : Rect, style : GUIStyle) : void

static function BeginArea (screenRect : Rect, text : string, style : GUIStyle) : void

static function BeginArea (screenRect : Rect, image : Texture, style : GUIStyle) : void

static function BeginArea (screenRect : Rect, content : GUIContent, style : GUIStyle) : void

Parameters

NameDescription
text Optional text to display in the area.
image Optional texture to display in the area.
content Optional text, image and tooltip top display for this area.
style The style to use. If left out, the empty GUIStyle (GUIStyle.none) is used, giving a transparent background. See Also: EndArea

Description

Begin a GUILayout block of GUI controls in a fixed screen area.

By default, any GUI controls made using GUILayout are placed in the top-left corner of the screen. If you want to place a series of automatically layouted controls in an arbitrary area, use GUILayout.BeginArea to define a new area for the automatic layouting system to use.

function OnGUI () {
GUILayout.BeginArea (Rect (200,200,100,100));
GUILayout.Button ("Click me");
GUILayout.Button ("Or me");
GUILayout.EndArea ();

This function is very useful when mixing GUILayout code. It must be matched with a call to EndArea. BeginArea / EndArea cannot be nested.