Hide
LayoutDisableIf / LayoutEnableIf
Important
Enable SaintsEditor before using

Disable or enable an entire layout group. These attributes will work on the first layout underneath it.

Arguments:

  • (Optional) EMode editorMode

    Condition: if it should be in edit mode, play mode for Editor or in some prefab stage. By default, (omitting this parameter) it does not check the mode at all.

    See Misc - EMode for more information.

  • object by...

    callbacks or attributes for the condition.

  • AllowMultiple: Yes

You can use multiple LayoutDisableIf, LayoutEnableIf, and even a mix of the two.

For LayoutDisableIf: The layout group will be disabled if ALL condition is true (and operation)

For LayoutEnableIf: The layout group will be enabled if ANY condition is true (or operation)

For multiple attributes: The layout group will be disabled if ANY condition is true (or operation)

It also supports sub-field, and value comparison like ==, >, <=. Read more in the "Syntax for Show/Hide/Enable/Disable/Required-If" section.

using SaintsField.Playa; public bool editableMain; [LayoutEnableIf(nameof(editableMain))] [LayoutStart("Main", ELayout.FoldoutBox)] public bool editable1; [LayoutEnableIf(nameof(editable1))] [LayoutStart("./1", ELayout.FoldoutBox, marginBottom: 10)] public int int1; public string string1; [LayoutStart("..")] public bool editable2; [LayoutEnableIf(nameof(editable2))] [LayoutStart("./2", ELayout.FoldoutBox)] public int int2; public string string2; [LayoutEnd] [Space] public string layoutEnd;