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