using UnityEngine; namespace EditorAttributes { public enum MessageMode { None, Log, Warning, Error } /// /// Attribute to display a message box depending on a condition /// public class MessageBoxAttribute : PropertyAttribute, IConditionalAttribute, IDynamicStringAttribute { public int EnumValue { get; private set; } public bool DrawAbove { get; private set; } public string Message { get; private set; } public string ConditionName { get; private set; } public MessageMode MessageType { get; private set; } public StringInputMode StringInputMode { get; private set; } /// /// Attribute to display a message box depending on a condition /// /// The message to display /// The condition to evaluate /// The type of the message /// Set if the string input is set trough a constant or dynamically trough another member /// Draws the HelpBox above the attached field public MessageBoxAttribute(string message, string conditionName, MessageMode messageType = MessageMode.Log, StringInputMode stringInputMode = StringInputMode.Constant, bool drawAbove = false) #if UNITY_2023_3_OR_NEWER : base(true) #endif { Message = message; ConditionName = conditionName; MessageType = messageType; StringInputMode = stringInputMode; DrawAbove = drawAbove; } /// /// Attribute to display a message box depending on a condition /// /// The message to display /// The condition to evaluate /// The value of the enum /// The type of the message /// Set if the string input is set trough a constant or dynamically trough another member /// Draws the HelpBox above the attached field public MessageBoxAttribute(string message, string conditionName, object enumValue, MessageMode messageType = MessageMode.Log, StringInputMode stringInputMode = StringInputMode.Constant, bool drawAbove = false) #if UNITY_2023_3_OR_NEWER : base(true) #endif { Message = message; EnumValue = (int)enumValue; ConditionName = conditionName; MessageType = messageType; DrawAbove = drawAbove; } } }