FieldEnableIf/FieldDisableIf/FieldReadOnlyLike EnableIf/DisableIf, but:
- When using on array/list, it works on every element of array/list rather than array/list itself
- Only works on serialized field, not work with
ShowInInspector,Button - Using on a single serialized field, it works just like
EnableIf/DisableIf
This can be helpful if you can not enable SaintsEditor.
It also supports sub-field, and value comparison like ==, >, <=. Read more in the "Syntax for Show/Hide/Enable/Disable/Required-If" section.
// Control by field/property public bool enable; [FieldEnableIf(nameof(enable))] public string byField; // Control by callback [FieldEnableIf(nameof(ShouldEnable))] public string byCallback; // You can omit the parameter if you do not need it public bool ShouldEnable(string input) => input.Length < 6; [FieldEnableIf(nameof(ShouldEnableElement))] public string[] forArray; public bool ShouldEnableElement(string element, int index) => index % 2 == 0;