FlexibleSpace

Scope that inserts GUILayout.FlexibleSpace() at the beginning and/or end of the scope's lifetime. Useful for centering content or pushing elements to edges within horizontal/vertical layouts.

Definition

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

public static partial class DrawGUI
{
    // Factory method
    public static Scope FlexibleSpace(bool begin, bool end)

    // Extension method (chaining)
    public static Scope FlexibleSpace(this Scope scope, bool begin, bool end)

    // Implementation
    private class FlexibleSpaceScope : Scope
}

Remarks

Unlike most scopes that wrap a Begin/End pair around content, FlexibleSpaceScope inserts flexible space before content (in OnBegin) and/or after content (in OnEnd). The begin and end booleans control which spaces are added.

Factory Methods

FlexibleSpace

Creates a scope that inserts flexible space at the specified positions.

Parameter
Type
Description

begin

bool

If true, inserts GUILayout.FlexibleSpace() at scope begin

end

bool

If true, inserts GUILayout.FlexibleSpace() at scope end

Common Patterns

begin

end

Effect

true

true

Centers content between flexible spaces

true

false

Pushes content to the right/bottom

false

true

Pushes content to the left/top

Examples

Center Content

Right-Align Buttons

Left-Align with Trailing Space

See Also

Last updated