GUILayout.HorizontalScope
Disposable helper class for managing GUILayout.BeginHorizontal / GUILayout.EndHorizontal.
Read time 1 minuteLast updated 12 days ago
Definition
- Type: Class
- Namespace: UnityEngine
- Assembly: UnityEngine.IMGUIModule
- Inherits from: Scope
- Implements: IDisposable
public class GUILayout.HorizontalScope : GUI.Scope, IDisposable
Remarks
All controls rendered inside this element will be placed horizontally next to each other. The statement means GUILayout.BeginHorizontal and GUILayout.EndHorizontal are not needed.
using
Horizontal Layout.
Examples
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[]) | Create a new HorizontalScope and begin the corresponding horizontal group. |
| HorizontalScope(UnityEngine.GUIContent,UnityEngine.GUIStyle,UnityEngine.GUILayoutOption[]) | Create a new HorizontalScope and begin the corresponding horizontal group. |
| 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. |
| HorizontalScope(UnityEngine.Texture,UnityEngine.GUIStyle,UnityEngine.GUILayoutOption[]) | Create a new HorizontalScope and begin the corresponding horizontal group. |