# GUILayout.HorizontalScope

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

## Definition

* **Type:** Class
* **Namespace:** [UnityEngine](/engine/6000.5/script-reference/unityengine.md)
* **Assembly:** UnityEngine.IMGUIModule
* **Inherits from:** Scope
* **Implements:** [IDisposable](https://learn.microsoft.com/dotnet/api/system.idisposable)

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

## Remarks

All controls rendered inside this element will be placed horizontally next to each other.  The `using` statement means [GUILayout.BeginHorizontal](/engine/6000.5/script-reference/unityengine/guilayout/beginhorizontal.md) and [GUILayout.EndHorizontal](/engine/6000.5/script-reference/unityengine/guilayout/endhorizontal.md) are not needed.

![GUILayoutHorizontal (GUILayout.HorizontalScope)](/api/media?file=/engine/6000.5/media/images/GUILayoutHorizontal.png)

*Horizontal Layout.*

## Examples

```csharp
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    void OnGUI()
    {
        // Starts a horizontal group
        using (var horizontalScope = new GUILayout.HorizontalScope("box"))
        {
            GUILayout.Button("I'm the first button");
            GUILayout.Button("I'm to the right");
        }
        // Now the group is ended.
    }
}
```

## Constructors

| Constructor                                                                                                                                                                                                                          | Description                                                                |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------- |
| [HorizontalScope(System.String,UnityEngine.GUIStyle,UnityEngine.GUILayoutOption\[\])](/engine/6000.5/script-reference/unityengine/guilayout/horizontalscope/ctor.md#horizontalscope\(string-guistyle-guilayoutoption\))              | Create a new HorizontalScope and begin the corresponding horizontal group. |
| [HorizontalScope(UnityEngine.GUIContent,UnityEngine.GUIStyle,UnityEngine.GUILayoutOption\[\])](/engine/6000.5/script-reference/unityengine/guilayout/horizontalscope/ctor.md#horizontalscope\(guicontent-guistyle-guilayoutoption\)) | Create a new HorizontalScope and begin the corresponding horizontal group. |
| [HorizontalScope(UnityEngine.GUILayoutOption\[\])](/engine/6000.5/script-reference/unityengine/guilayout/horizontalscope/ctor.md#horizontalscope\(guilayoutoption\))                                                                 | Create a new HorizontalScope and begin the corresponding horizontal group. |
| [HorizontalScope(UnityEngine.GUIStyle,UnityEngine.GUILayoutOption\[\])](/engine/6000.5/script-reference/unityengine/guilayout/horizontalscope/ctor.md#horizontalscope\(guistyle-guilayoutoption\))                                   | Create a new HorizontalScope and begin the corresponding horizontal group. |
| [HorizontalScope(UnityEngine.Texture,UnityEngine.GUIStyle,UnityEngine.GUILayoutOption\[\])](/engine/6000.5/script-reference/unityengine/guilayout/horizontalscope/ctor.md#horizontalscope\(texture-guistyle-guilayoutoption\))       | Create a new HorizontalScope and begin the corresponding horizontal group. |
