Enable If Attribute

EnableIf is used on any property, and can enable or disable the property in the inspector. Use this to enable properties when they are relevant.

public UnityEngine.Object SomeObject;

public InfoMessageType SomeEnum;

public bool IsToggled;

[EnableIf("SomeEnum", InfoMessageType.Info)]
public Vector2 Info;

[EnableIf("SomeEnum", InfoMessageType.Error)]
public Vector2 Error;

[EnableIf("SomeEnum", InfoMessageType.Warning)]
public Vector2 Warning;

public int EnableIfToggled;

public Vector3 EnabledWhenHasReference;

[EnableIf("@this.IsToggled && this.SomeObject != null || this.SomeEnum == InfoMessageType.Error")]
public int EnableWithExpression;