/// <summary> /// Creates a button for a method with arguments to call it from the inspector. /// </summary> /// <param name="color">Button's color.</param> /// <param name="buttonMode">Changes when the button should be enabled.</param> /// <param name="arguments">The parameters list of the method.</param> public ButtonAttribute(string label, EColor color, EButtonMode buttonMode = EButtonMode.AlwaysEnabled, params System.Object[] arguments) { Label = label; Color = Colors.FromEColor(color); ButtonMode = buttonMode; Arguments = arguments; }
private bool HandleButtonMode(EButtonMode buttonMode) { bool enableGui = true; switch (buttonMode) { case EButtonMode.AlwaysEnabled: enableGui = true; break; case EButtonMode.EditorOnly: enableGui = !EditorApplication.isPlaying; break; case EButtonMode.PlayModeOnly: enableGui = EditorApplication.isPlaying; break; default: throw new ArgumentOutOfRangeException(); } return(enableGui); }
/// <summary> /// Creates a button for a method with arguments to call it from the inspector. /// </summary> /// <param name="buttonMode">Changes when the button should be enabled.</param> /// <param name="arguments">The parameters list of the method.</param> public ButtonAttribute(string label, EButtonMode buttonMode = EButtonMode.AlwaysEnabled, params System.Object[] arguments) { Label = label; ButtonMode = buttonMode; Arguments = arguments; }
/// <summary> /// Creates a button for a method with arguments to call it from the inspector. /// </summary> /// <param name="color">Button's color.</param> /// <param name="buttonMode">Changes when the button should be enabled.</param> public ButtonAttribute(string label, EColor color, EButtonMode buttonMode = EButtonMode.AlwaysEnabled) { Label = label; Color = Colors.FromEColor(color); ButtonMode = buttonMode; }
/// <summary> /// Creates a button for a method to call it from the inspector. /// </summary> /// <param name="label">Button label shown in the inspector.</param> /// <param name="buttonMode">Changes when the button should be enabled.</param> public ButtonAttribute(string label, EButtonMode buttonMode = EButtonMode.AlwaysEnabled) { Label = label; ButtonMode = buttonMode; Arguments = null; }
/// <summary> /// Creates a button for a method with arguments to call it from the inspector. /// </summary> /// <param name="buttonMode">Changes when the button should be enabled.</param> /// <param name="arguments">The parameters list of the method.</param> public ButtonAttribute(EButtonMode buttonMode = EButtonMode.AlwaysEnabled, params System.Object[] arguments) { ButtonMode = buttonMode; Arguments = arguments; }
/// <summary> /// Creates a button for a method with arguments to call it from the inspector. /// </summary> /// <param name="color">Button's color.</param> /// <param name="buttonMode">Changes when the button should be enabled.</param> public ButtonAttribute(EColor color, EButtonMode buttonMode = EButtonMode.AlwaysEnabled) { Color = Colors.FromEColor(color); ButtonMode = buttonMode; }
/// <summary> /// Creates a button for a method to call it from the inspector. /// </summary> /// <param name="buttonMode">Changes when the button should be enabled.</param> public ButtonAttribute(EButtonMode buttonMode = EButtonMode.AlwaysEnabled) { ButtonMode = buttonMode; Arguments = null; }