BeginArea
Begin a GUILayout block of GUI controls in a fixed screen area.
Read time 7 minutesLast updated 4 days ago
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.IMGUIModule
BeginArea(Rect)
Begin a GUILayout block of GUI controls in a fixed screen area.
public static void BeginArea(Rect screenRect)
Parameters
Remarks
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 laid out controls in an arbitrary area, use GUILayout.BeginArea to define a new area for the automatic layouting system to use.
Additional Resources: GUILayout.EndArea

Explained Area of the example.
using UnityEngine;public class ExampleScript : MonoBehaviour{ void OnGUI() { // Starts an area to draw elements GUILayout.BeginArea(new Rect(10, 10, 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.
BeginArea(Rect, string)
Begin a GUILayout block of GUI controls in a fixed screen area.
public static void BeginArea(Rect screenRect, string text)
Parameters
Remarks
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 laid out controls in an arbitrary area, use GUILayout.BeginArea to define a new area for the automatic layouting system to use.
Additional Resources: GUILayout.EndArea

Explained Area of the example.
using UnityEngine;public class ExampleScript : MonoBehaviour{ void OnGUI() { // Starts an area to draw elements GUILayout.BeginArea(new Rect(10, 10, 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.
BeginArea(Rect, Texture)
Begin a GUILayout block of GUI controls in a fixed screen area.
public static void BeginArea(Rect screenRect, Texture image)
Parameters
Remarks
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 laid out controls in an arbitrary area, use GUILayout.BeginArea to define a new area for the automatic layouting system to use.
Additional Resources: GUILayout.EndArea

Explained Area of the example.
using UnityEngine;public class ExampleScript : MonoBehaviour{ void OnGUI() { // Starts an area to draw elements GUILayout.BeginArea(new Rect(10, 10, 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.
BeginArea(Rect, GUIContent)
Begin a GUILayout block of GUI controls in a fixed screen area.
public static void BeginArea(Rect screenRect, GUIContent content)
Parameters
Remarks
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 laid out controls in an arbitrary area, use GUILayout.BeginArea to define a new area for the automatic layouting system to use.
Additional Resources: GUILayout.EndArea

Explained Area of the example.
using UnityEngine;public class ExampleScript : MonoBehaviour{ void OnGUI() { // Starts an area to draw elements GUILayout.BeginArea(new Rect(10, 10, 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.
BeginArea(Rect, GUIStyle)
Begin a GUILayout block of GUI controls in a fixed screen area.
public static void BeginArea(Rect screenRect, GUIStyle style)
Parameters
The style to use. If left out, the empty GUIStyle (GUIStyle.none) is used, giving a transparent background.
Remarks
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 laid out controls in an arbitrary area, use GUILayout.BeginArea to define a new area for the automatic layouting system to use.
Additional Resources: GUILayout.EndArea

Explained Area of the example.
using UnityEngine;public class ExampleScript : MonoBehaviour{ void OnGUI() { // Starts an area to draw elements GUILayout.BeginArea(new Rect(10, 10, 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.
BeginArea(Rect, string, GUIStyle)
Begin a GUILayout block of GUI controls in a fixed screen area.
public static void BeginArea(Rect screenRect, string text, GUIStyle style)
Parameters
Optional text to display in the area.
The style to use. If left out, the empty GUIStyle (GUIStyle.none) is used, giving a transparent background.
Remarks
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 laid out controls in an arbitrary area, use GUILayout.BeginArea to define a new area for the automatic layouting system to use.
Additional Resources: GUILayout.EndArea

Explained Area of the example.
using UnityEngine;public class ExampleScript : MonoBehaviour{ void OnGUI() { // Starts an area to draw elements GUILayout.BeginArea(new Rect(10, 10, 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.
BeginArea(Rect, Texture, GUIStyle)
Begin a GUILayout block of GUI controls in a fixed screen area.
public static void BeginArea(Rect screenRect, Texture image, GUIStyle style)
Parameters
Optional texture to display in the area.
The style to use. If left out, the empty GUIStyle (GUIStyle.none) is used, giving a transparent background.
Remarks
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 laid out controls in an arbitrary area, use GUILayout.BeginArea to define a new area for the automatic layouting system to use.
Additional Resources: GUILayout.EndArea

Explained Area of the example.
using UnityEngine;public class ExampleScript : MonoBehaviour{ void OnGUI() { // Starts an area to draw elements GUILayout.BeginArea(new Rect(10, 10, 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.
BeginArea(Rect, GUIContent, GUIStyle)
Begin a GUILayout block of GUI controls in a fixed screen area.
public static void BeginArea(Rect screenRect, GUIContent content, GUIStyle style)
Parameters
Optional text, image and tooltip top display for this area.
The style to use. If left out, the empty GUIStyle (GUIStyle.none) is used, giving a transparent background.
Remarks
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 laid out controls in an arbitrary area, use GUILayout.BeginArea to define a new area for the automatic layouting system to use.
Additional Resources: GUILayout.EndArea

Explained Area of the example.
using UnityEngine;public class ExampleScript : MonoBehaviour{ void OnGUI() { // Starts an area to draw elements GUILayout.BeginArea(new Rect(10, 10, 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.