GUILayout.AreaScope
Disposable helper class for managing GUILayout.BeginArea / GUILayout.EndArea.
Read time 1 minuteLast updated 10 days ago
Definition
- Type: Class
- Namespace: UnityEngine
- Assembly: UnityEngine.IMGUIModule
- Inherits from: Scope
- Implements: IDisposable
public class GUILayout.AreaScope : GUI.Scope, IDisposable
Remarks
GUILayout.BeginArea is called at construction, and GUILayout.EndArea is called when the instance is disposed. 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.BeginArea, GUILayout.EndArea

Explained Area of the example.
Examples
using UnityEngine;public class ExampleClass : MonoBehaviour{ void OnGUI() { using (var areaScope = new GUILayout.AreaScope(new Rect(10, 10, 100, 100))) { GUILayout.Button("Click me"); GUILayout.Button("Or me"); } }}
Constructors
Constructor | Description |
|---|---|
| AreaScope(UnityEngine.Rect) | Create a new AreaScope and begin the corresponding Area. |
| AreaScope(UnityEngine.Rect,System.String) | Create a new AreaScope and begin the corresponding Area. |
| AreaScope(UnityEngine.Rect,System.String,UnityEngine.GUIStyle) | Create a new AreaScope and begin the corresponding Area. |
| AreaScope(UnityEngine.Rect,UnityEngine.GUIContent) | Create a new AreaScope and begin the corresponding Area. |
| AreaScope(UnityEngine.Rect,UnityEngine.GUIContent,UnityEngine.GUIStyle) | Create a new AreaScope and begin the corresponding Area. |
| AreaScope(UnityEngine.Rect,UnityEngine.Texture) | Create a new AreaScope and begin the corresponding Area. |
| AreaScope(UnityEngine.Rect,UnityEngine.Texture,UnityEngine.GUIStyle) | Create a new AreaScope and begin the corresponding Area. |