VerticalLayout

DrawGUI scope that wraps EditorGUILayout.BeginVertical/EndVertical into a disposable using block. Arranges child elements in a vertical column with optional style and layout options.

Definition

Namespace: Paragon.Editor Assembly: Paragon.Editor.dll

public static partial class DrawGUI
{
    public static Scope VerticalLayout(params GUILayoutOption[] options)
    public static Scope VerticalLayout(GUIStyle style, params GUILayoutOption[] options)
    public static Scope VerticalLayout(this Scope scope, params GUILayoutOption[] options)
    public static Scope VerticalLayout(this Scope scope, GUIStyle style, params GUILayoutOption[] options)

    private class VerticalLayoutScope : Scope
}

Remarks

This file contributes factory and extension methods to the DrawGUI partial class, plus a private nested VerticalLayoutScope implementation. The scope calls EditorGUILayout.BeginVertical on construction and EditorGUILayout.EndVertical on disposal.

When no GUIStyle is provided, GUIStyle.none is used as the default.

Quick Lookup

Goal
How

Basic vertical layout

using (DrawGUI.VerticalLayout()) { ... }

With style

using (DrawGUI.VerticalLayout(Style.Box)) { ... }

With layout options

using (DrawGUI.VerticalLayout(GUILayout.Width(200))) { ... }

Chain onto another scope

using (DrawGUI.HorizontalLayout().VerticalLayout()) { ... }

Chain with style

using (scope.VerticalLayout(myStyle)) { ... }

Factory Methods

Standalone

Signature
Description

VerticalLayout(params GUILayoutOption[])

Creates a vertical layout with GUIStyle.none

VerticalLayout(GUIStyle, params GUILayoutOption[])

Creates a vertical layout with the specified style

Extension (Chaining)

Signature
Description

VerticalLayout(this Scope, params GUILayoutOption[])

Pushes a vertical layout onto an existing scope

VerticalLayout(this Scope, GUIStyle, params GUILayoutOption[])

Pushes a styled vertical layout onto an existing scope

Returns: Scope — the root scope (for standalone) or the parent scope with the new scope pushed (for chaining).

VerticalLayoutScope (private)

Member
Description

style

GUIStyle — the layout style

options

GUILayoutOption[] — layout options (width, height, etc.)

OnBegin()

Calls EditorGUILayout.BeginVertical(style, options)

OnEnd()

Calls EditorGUILayout.EndVertical()

Examples

Stacked Elements

Box-Styled Container

Multi-Column Layout

See Also

Last updated