# EditorGUILayout.HorizontalScope

> Disposable helper class for managing EditorGUILayout.BeginHorizontal / EditorGUILayout.EndHorizontal.

## Definition

* **Type:** Class
* **Namespace:** [UnityEditor](/engine/6000.7/script-reference/unityeditor.md)
* **Assembly:** UnityEditor.CoreModule
* **Inherits from:** Scope
* **Implements:** [IDisposable](https://learn.microsoft.com/dotnet/api/system.idisposable)

```csharp
public class EditorGUILayout.HorizontalScope : GUI.Scope, IDisposable
```

## Remarks

This is an extension to [GUILayout.HorizontalScope](/engine/6000.7/script-reference/unityengine/guilayout/horizontalscope.md). It can be used for making compound controls

![BeginEndHorizontalExample (EditorGUILayout.HorizontalScope)](/api/media?file=/engine/6000.7/media/images/BeginEndHorizontalExample.png)

*Horizontal Compound group.*

## Examples

```csharp
using UnityEngine;
using UnityEditor;

// Create a Horizontal Compound Button
class 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\[\])](/engine/6000.7/script-reference/unityeditor/editorguilayout/horizontalscope/ctor.md#horizontalscope\(guilayoutoption\))                               | Create a new HorizontalScope and begin the corresponding horizontal group. |
| [HorizontalScope(UnityEngine.GUIStyle,UnityEngine.GUILayoutOption\[\])](/engine/6000.7/script-reference/unityeditor/editorguilayout/horizontalscope/ctor.md#horizontalscope\(guistyle-guilayoutoption\)) | Create a new HorizontalScope and begin the corresponding horizontal group. |

## Properties

| Property                                                                                    | Description                       |
| ------------------------------------------------------------------------------------------- | --------------------------------- |
| [rect](/engine/6000.7/script-reference/unityeditor/editorguilayout/horizontalscope/rect.md) | The rect of the horizontal group. |
