using UnityEngine;
namespace EditorAttributes
{
///
/// Attribute to disable a field based on a condition
///
public class DisableFieldAttribute : PropertyAttribute, IConditionalAttribute
{
public string ConditionName { get; private set; }
public int EnumValue { get; private set; }
///
/// Attribute to disable a field based on a condition
///
/// The name of the condition to evaluate
public DisableFieldAttribute(string conditionName)
#if UNITY_2023_3_OR_NEWER
: base(true)
#endif
=> ConditionName = conditionName;
///
/// Attribute to disable a field based on a condition
///
/// The name of the condition to evaluate
/// The value of the enum condition
public DisableFieldAttribute(string conditionName, object enumValue)
#if UNITY_2023_3_OR_NEWER
: base(true)
#endif
{
ConditionName = conditionName;
EnumValue = (int)enumValue;
}
}
}