ReadonlyIf

Scope that conditionally disables (grays out) all GUI elements within its block. Wraps EditorGUI.BeginDisabledGroup/EndDisabledGroup.

Definition

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

public static partial class DrawGUI
{
    // Factory method
    public static Scope ReadonlyIf(bool condition)

    // Extension method (chaining)
    public static Scope ReadonlyIf(this Scope scope, bool condition)

    // Implementation
    private class ReadOnlyIfScope : Scope
}

Remarks

When condition is true, all GUI elements drawn inside the scope are disabled — they appear grayed out and cannot be interacted with. When condition is false, the scope has no visual or behavioral effect (the disabled group still wraps but does not disable).

Factory Methods

ReadonlyIf

Creates a scope that conditionally disables GUI elements.

Parameter
Type
Description

condition

bool

If true, GUI elements inside the scope are disabled. If false, no effect

Common Pitfalls

circle-info

Disabled groups nest additively. Unity's EditorGUI.BeginDisabledGroup groups nest — once disabled by an outer group, inner groups cannot re-enable. A ReadonlyIf(false) inside a ReadonlyIf(true) will still be disabled.

Examples

Conditional Read-Only Fields

Chain with Box

Chain with Colorize for Visual Feedback

See Also

  • DrawGUI.Scope — abstract base class

  • Colorize — visual-only color tinting (complements ReadonlyIf)

  • Scopes — all scope implementations

Last updated