# GUILayout

> The GUILayout class is the interface for Unity gui with automatic layout. Unlike the standard GUI class which requires manual coordinates, GUILayout arranges controls based on their content and container.

## Definition

* **Type:** Class
* **Namespace:** [UnityEngine](/engine/6000.6/script-reference/unityengine.md)
* **Assembly:** UnityEngine.IMGUIModule

```csharp
public class GUILayout
```

## Remarks

```csharp
// This example creates a simple UI using the IMGUI system.
using UnityEngine;

public class Example : MonoBehaviour
{
    private string playerName = "";
    private int playerAge = 0;

    void OnGUI()
    {
        // Begin a horizontal group
        GUILayout.BeginHorizontal();

        // Add GUI elements that will be arranged horizontally
        GUILayout.Label("Name: ", GUILayout.Width(50));
        playerName = GUILayout.TextField(playerName, GUILayout.Width(100));

        GUILayout.Label("Age: ", GUILayout.Width(40));
        playerAge = int.Parse(GUILayout.TextField(playerAge.ToString(), GUILayout.Width(30)));

        // End the horizontal group
        GUILayout.EndHorizontal();
    }
}
```

Additional Resources: [GUI Layout tutorial](/engine/6000.6/manual/uitoolkits/ui-imgui/gui-layout.md).

## Static Methods

| Method                                                                                              | Description                                                                                |
| --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| [BeginArea](/engine/6000.6/script-reference/unityengine/guilayout/beginarea.md)                     | Begin a GUILayout block of GUI controls in a fixed screen area.                            |
| [BeginHorizontal](/engine/6000.6/script-reference/unityengine/guilayout/beginhorizontal.md)         | Begin a Horizontal control group.                                                          |
| [BeginScrollView](/engine/6000.6/script-reference/unityengine/guilayout/beginscrollview.md)         | Begin an automatically laid out scrollview.                                                |
| [BeginVertical](/engine/6000.6/script-reference/unityengine/guilayout/beginvertical.md)             | Begin a vertical control group.                                                            |
| [Box](/engine/6000.6/script-reference/unityengine/guilayout/box.md)                                 | Make an auto-layout box.                                                                   |
| [Button](/engine/6000.6/script-reference/unityengine/guilayout/button.md)                           | Make a single press button.                                                                |
| [EndArea](/engine/6000.6/script-reference/unityengine/guilayout/endarea.md)                         | Close a GUILayout block started with BeginArea.                                            |
| [EndHorizontal](/engine/6000.6/script-reference/unityengine/guilayout/endhorizontal.md)             | Close a group started with BeginHorizontal.                                                |
| [EndScrollView](/engine/6000.6/script-reference/unityengine/guilayout/endscrollview.md)             | End a scroll view begun with a call to BeginScrollView.                                    |
| [EndVertical](/engine/6000.6/script-reference/unityengine/guilayout/endvertical.md)                 | Close a group started with BeginVertical.                                                  |
| [ExpandHeight](/engine/6000.6/script-reference/unityengine/guilayout/expandheight.md)               | Option passed to a control to allow or disallow vertical expansion.                        |
| [ExpandWidth](/engine/6000.6/script-reference/unityengine/guilayout/expandwidth.md)                 | Option passed to a control to allow or disallow horizontal expansion.                      |
| [FlexibleSpace](/engine/6000.6/script-reference/unityengine/guilayout/flexiblespace.md)             | Insert a flexible space element.                                                           |
| [Height](/engine/6000.6/script-reference/unityengine/guilayout/height.md)                           | Option passed to a control to give it an absolute height.                                  |
| [HorizontalScrollbar](/engine/6000.6/script-reference/unityengine/guilayout/horizontalscrollbar.md) | Make a horizontal scrollbar.                                                               |
| [HorizontalSlider](/engine/6000.6/script-reference/unityengine/guilayout/horizontalslider.md)       | A horizontal slider the user can drag to change a value between a min and a max.           |
| [Label](/engine/6000.6/script-reference/unityengine/guilayout/label.md)                             | Make an auto-layout label.                                                                 |
| [MaxHeight](/engine/6000.6/script-reference/unityengine/guilayout/maxheight.md)                     | Option passed to a control to specify a maximum height.                                    |
| [MaxWidth](/engine/6000.6/script-reference/unityengine/guilayout/maxwidth.md)                       | Option passed to a control to specify a maximum width.                                     |
| [MinHeight](/engine/6000.6/script-reference/unityengine/guilayout/minheight.md)                     | Option passed to a control to specify a minimum height.                                    |
| [MinWidth](/engine/6000.6/script-reference/unityengine/guilayout/minwidth.md)                       | Option passed to a control to specify a minimum width.                                     |
| [PasswordField](/engine/6000.6/script-reference/unityengine/guilayout/passwordfield.md)             | Make a text field where the user can enter a password.                                     |
| [RepeatButton](/engine/6000.6/script-reference/unityengine/guilayout/repeatbutton.md)               | Make a repeating button. The button returns true as long as the user holds down the mouse. |
| [SelectionGrid](/engine/6000.6/script-reference/unityengine/guilayout/selectiongrid.md)             | Make a Selection Grid.                                                                     |
| [Space](/engine/6000.6/script-reference/unityengine/guilayout/space.md)                             | Insert a space in the current layout group.                                                |
| [TextArea](/engine/6000.6/script-reference/unityengine/guilayout/textarea.md)                       | Make a multi-line text field where the user can edit a string.                             |
| [TextField](/engine/6000.6/script-reference/unityengine/guilayout/textfield.md)                     | Make a single-line text field where the user can edit a string.                            |
| [Toggle](/engine/6000.6/script-reference/unityengine/guilayout/toggle.md)                           | Make an on/off toggle button.                                                              |
| [Toolbar](/engine/6000.6/script-reference/unityengine/guilayout/toolbar.md)                         | Make a toolbar.                                                                            |
| [VerticalScrollbar](/engine/6000.6/script-reference/unityengine/guilayout/verticalscrollbar.md)     | Make a vertical scrollbar.                                                                 |
| [VerticalSlider](/engine/6000.6/script-reference/unityengine/guilayout/verticalslider.md)           | A vertical slider the user can drag to change a value between a min and a max.             |
| [Width](/engine/6000.6/script-reference/unityengine/guilayout/width.md)                             | Option passed to a control to give it an absolute width.                                   |
| [Window](/engine/6000.6/script-reference/unityengine/guilayout/window.md)                           | Make a popup window that layouts its contents automatically.                               |

## Classes

| Class                                                                                                 | Description                                                                                                                                                                                                                                     |
| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [GUILayout.AreaScope](/engine/6000.6/script-reference/unityengine/guilayout/areascope.md)             | Disposable helper class for managing [GUILayout.BeginArea](/engine/6000.6/script-reference/unityengine/guilayout/beginarea.md) / [GUILayout.EndArea](/engine/6000.6/script-reference/unityengine/guilayout/endarea.md).                         |
| [GUILayout.HorizontalScope](/engine/6000.6/script-reference/unityengine/guilayout/horizontalscope.md) | Disposable helper class for managing [GUILayout.BeginHorizontal](/engine/6000.6/script-reference/unityengine/guilayout/beginhorizontal.md) / [GUILayout.EndHorizontal](/engine/6000.6/script-reference/unityengine/guilayout/endhorizontal.md). |
| [GUILayout.ScrollViewScope](/engine/6000.6/script-reference/unityengine/guilayout/scrollviewscope.md) | Disposable helper class for managing [GUILayout.BeginScrollView](/engine/6000.6/script-reference/unityengine/guilayout/beginscrollview.md) / [GUILayout.EndScrollView](/engine/6000.6/script-reference/unityengine/guilayout/endscrollview.md). |
| [GUILayout.VerticalScope](/engine/6000.6/script-reference/unityengine/guilayout/verticalscope.md)     | Disposable helper class for managing [GUILayout.BeginVertical](/engine/6000.6/script-reference/unityengine/guilayout/beginvertical.md) / [GUILayout.EndVertical](/engine/6000.6/script-reference/unityengine/guilayout/endvertical.md).         |
