EditorGUILayout.HorizontalScope
Disposable helper class for managing EditorGUILayout.BeginHorizontal / EditorGUILayout.EndHorizontal.
Read time 1 minuteLast updated 13 days ago
Definition
- Type: Class
- Namespace: UnityEditor
- Assembly: UnityEditor
- Inherits from: Scope
- Implements: IDisposable
public class EditorGUILayout.HorizontalScope : GUI.Scope, IDisposable
Remarks
This is an extension to GUILayout.HorizontalScope. It can be used for making compound controls

Horizontal Compound group.
Examples
using UnityEngine;using UnityEditor;// Create a Horizontal Compound Buttonclass HorizontalScopeExample : EditorWindow{ [MenuItem("Examples/Horizontal scope usage")] static void Init() { var window = GetWindow<HorizontalScopeExample>(); window.Show(); } void OnGUI() { using (var h = new EditorGUILayout.HorizontalScope("Button")) { if (GUI.Button(h.rect, GUIContent.none)) Debug.Log("Go here"); GUILayout.Label("I'm inside the button"); GUILayout.Label("So am I"); } }}
Constructors
Constructor | Description |
|---|---|
| HorizontalScope(UnityEngine.GUILayoutOption[]) | Create a new HorizontalScope and begin the corresponding horizontal group. |
| HorizontalScope(UnityEngine.GUIStyle,UnityEngine.GUILayoutOption[]) | Create a new HorizontalScope and begin the corresponding horizontal group. |
Properties
Property | Description |
|---|---|
| rect | The rect of the horizontal group. |