Learn / Documentation / UIButton
Scripting

Description

UIButton is a core component in the DoozyUI system. It contains all the logic needed for a button to work and behave in various ways in order to create complex UI interactions.

Component Details

Gesture Listener
Gesture Listener
Gesture Listener
  • Settings – Opens the Control Panel at the Settings tab

  • Manual – Link to the manual page for this component

  • YouTube – Link to the quick video tutorial for this component

  • Debug Mode – Enables relevant debug messages to be printed to the console

  • Create Parent and Center Pivot – Creates a new GameObject with the same RectTransform settings as the UIButton, then reparents the UIButton to the newly created GameObject

  • Button Category – UIButton category name

  • Button Name – UIButton button name

  • Rename GameObject – Renames the UIButton GameObject to a predefined name

  • Open Database – Opens the Control Panel at the Buttons tab

  • Allow Multiple Clicks – If enabled, this button can be spam clicked and it won’t get disabled. Else, after each click, this button will get disabled for DisableButtonBetweenClicksInterval value.

  • Disable Button Interval – If AllowMultipleClicks is disabled, then this interval determines for how long this button gets disabled after each click, double click or long click

  • Deselect Button After Click – If enabled, after this button has been clicked, double clicked or long clicked, it will get automatically deselected

  • Input Mode – Allows the button to react to keys or virtual buttons (only when selected). See InputData

  • OnPointerEnter – Behavior when the pointer enters (hovers in) over the button’s area

  • OnPointerExit – Behavior when the pointer exits (hovers out) the button’s area (happens only after OnPointerEnter)

  • OnPointerDown – Behavior when the pointer is down over the button

  • OnPointerUp – Behavior when the pointer is up over the button (happens only after OnPointerDown)

  • OnClick – Behavior when the pointer performs a click over the button

  • OnDoubleClick – Behavior when the pointer performs a double click over the button

  • OnLongClick – Behavior when the pointer performs a long click over the button

  • OnSelected – Behavior when the button gets selected

  • OnDeselected – Behavior when the button gets deselected

  • Normal Loop Animation – Loop animation triggered when the button is not selected (in idle mode)

  • Selected Loop Animation – Loop animation triggered when the button gets selected (happens only after OnSelected UIButtonBehavior has been triggered)

  • Taget Label – Determines what type of label this button has (None, Text, TextMeshPro)

  • Text / TextMeshPro Label – Reference to the Text / TextMeshPro component used as a label for this button

Gesture Listener
Gesture Listener
Gesture Listener
Gesture Listener

OnPointerEnter Behavior

  • Select Button – Determines if the button should get selected after this behavior has been triggered

  • Disable Interval – Time interval after this behavior has been fired while it cannot be fired again

  • New Preset – Create a new preset with the current animation settings

  • Load Preset – Load the currently selected preset

  • Delete Preset – Delete the currently selected preset

  • Preset Category – Preset category name

  • Preset Name – Preset name

  • Load selected preset at runtime – Determines if the selected preset should override at runtime the current editor settings or not

  • Animation – @[email protected] executed when the behavior is triggered

  • OnTriggerUIAction executed when the behavior is triggered

  • Button Animation Type – Punch / State / Animator

  • Reset Animation Settings – Resets the current animation settings

Gesture Listener
Gesture Listener
Gesture Listener
Gesture Listener

OnPointerExit Behavior

  • Deselect Button – Determines if the button should get deselected after this behavior has been triggered

  • Disable Interval – Time interval after this behavior has been fired while it cannot be fired again

  • New Preset – Create a new preset with the current animation settings

  • Load Preset – Load the currently selected preset

  • Delete Preset – Delete the currently selected preset

  • Preset Category – Preset category name

  • Preset Name – Preset name

  • Load selected preset at runtime – Determines if the selected preset should override at runtime the current editor settings or not

  • Animation – @[email protected] executed when the behavior is triggered

  • OnTriggerUIAction executed when the behavior is triggered

  • Button Animation Type – Punch / State / Animator

  • Reset Animation Settings – Resets the current animation settings

Gesture Listener
Gesture Listener
Gesture Listener
Gesture Listener

OnPointerDown Behavior

  • Select Button – Determines if the button should get selected after this behavior has been triggered

  • New Preset – Create a new preset with the current animation settings

  • Load Preset – Load the currently selected preset

  • Delete Preset – Delete the currently selected preset

  • Preset Category – Preset category name

  • Preset Name – Preset name

  • Load selected preset at runtime – Determines if the selected preset should override at runtime the current editor settings or not

  • Animation – @[email protected] executed when the behavior is triggered

  • OnTriggerUIAction executed when the behavior is triggered

  • Button Animation Type – Punch / State / Animator

  • Reset Animation Settings – Resets the current animation settings

Gesture Listener
Gesture Listener
Gesture Listener
Gesture Listener

OnPointerUp Behavior

  • Deselect Button – Determines if the button should get deselected after this behavior has been triggered

  • New Preset – Create a new preset with the current animation settings

  • Load Preset – Load the currently selected preset

  • Delete Preset – Delete the currently selected preset

  • Preset Category – Preset category name

  • Preset Name – Preset name

  • Load selected preset at runtime – Determines if the selected preset should override at runtime the current editor settings or not

  • Animation – @[email protected] executed when the behavior is triggered

  • OnTriggerUIAction executed when the behavior is triggered

  • Button Animation Type – Punch / State / Animator

  • Reset Animation Settings – Resets the current animation settings

Gesture Listener
Gesture Listener
Gesture Listener
Gesture Listener

OnClick Behavior

  • Trigger events after animation – If enabled, all the events will get fired after the animation finished playing. This is useful if you want to be sure the user sees the button animation

  • Click Mode – Determines if on click is triggered instantly or after it checks if it’s a double click or not. Depending on your use case, you might need the Instant or Delayed mode. Default is set to Instant

  • New Preset – Create a new preset with the current animation settings

  • Load Preset – Load the currently selected preset

  • Delete Preset – Delete the currently selected preset

  • Preset Category – Preset category name

  • Preset Name – Preset name

  • Load selected preset at runtime – Determines if the selected preset should override at runtime the current editor settings or not

  • Animation – @[email protected] executed when the behavior is triggered

  • OnTriggerUIAction executed when the behavior is triggered

  • Button Animation Type – Punch / State / Animator

  • Reset Animation Settings – Resets the current animation settings

Gesture Listener
Gesture Listener
Gesture Listener
Gesture Listener

OnDoubleClick Behavior

  • Trigger events after animation – If enabled, all the events will get fired after the animation finished playing. This is useful if you want to be sure the user sees the button animation

  • Register Interval – Time interval used to register a double click. This is the time interval calculated between two sequential clicks to determine if either a double click, or two separate clicks occurred

  • New Preset – Create a new preset with the current animation settings

  • Load Preset – Load the currently selected preset

  • Delete Preset – Delete the currently selected preset

  • Preset Category – Preset category name

  • Preset Name – Preset name

  • Load selected preset at runtime – Determines if the selected preset should override at runtime the current editor settings or not

  • Animation – @[email protected] executed when the behavior is triggered

  • OnTriggerUIAction executed when the behavior is triggered

  • Button Animation Type – Punch / State / Animator

  • Reset Animation Settings – Resets the current animation settings

Gesture Listener
Gesture Listener
Gesture Listener
Gesture Listener

OnLongClick Behavior

  • Trigger events after animation – If enabled, all the events will get fired after the animation finished playing. This is useful if you want to be sure the user sees the button animation

  • Register Interval – Time interval used to register a long click. This is the time interval a button has to be pressed down to be considered a long click

  • New Preset – Create a new preset with the current animation settings

  • Load Preset – Load the currently selected preset

  • Delete Preset – Delete the currently selected preset

  • Preset Category – Preset category name

  • Preset Name – Preset name

  • Load selected preset at runtime – Determines if the selected preset should override at runtime the current editor settings or not

  • Animation – @[email protected] executed when the behavior is triggered

  • OnTriggerUIAction executed when the behavior is triggered

  • Button Animation Type – Punch / State / Animator

  • Reset Animation Settings – Resets the current animation settings

Gesture Listener
Gesture Listener
Gesture Listener
Gesture Listener

OnSelected Behavior

  • New Preset – Create a new preset with the current animation settings

  • Load Preset – Load the currently selected preset

  • Delete Preset – Delete the currently selected preset

  • Preset Category – Preset category name

  • Preset Name – Preset name

  • Load selected preset at runtime – Determines if the selected preset should override at runtime the current editor settings or not

  • Animation – @[email protected] executed when the behavior is triggered

  • OnTriggerUIAction executed when the behavior is triggered

  • Button Animation Type – Punch / State / Animator

  • Reset Animation Settings – Resets the current animation settings

Gesture Listener
Gesture Listener
Gesture Listener
Gesture Listener

OnDeselected Behavior

  • New Preset – Create a new preset with the current animation settings

  • Load Preset – Load the currently selected preset

  • Delete Preset – Delete the currently selected preset

  • Preset Category – Preset category name

  • Preset Name – Preset name

  • Load selected preset at runtime – Determines if the selected preset should override at runtime the current editor settings or not

  • Animation – @[email protected] executed when the behavior is triggered

  • OnTriggerUIAction executed when the behavior is triggered

  • Button Animation Type – Punch / State / Animator

  • Reset Animation Settings – Resets the current animation settings

Gesture Listener

Normal Loop Animation

  • New Preset – Create a new preset with the current animation settings

  • Load Preset – Load the currently selected preset

  • Delete Preset – Delete the currently selected preset

  • Preset Category – Preset category name

  • Preset Name – Preset name

  • Load selected preset at runtime – Determines if the selected preset should override at runtime the current editor settings or not

  • Reset Animation Settings – Resets the current animation settings

  • Loop Animation – @[email protected] – loop animation triggered when the button is not selected (in idle mode)

Gesture Listener

Selected Loop Animation

  • New Preset – Create a new preset with the current animation settings

  • Load Preset – Load the currently selected preset

  • Delete Preset – Delete the currently selected preset

  • Preset Category – Preset category name

  • Preset Name – Preset name

  • Load selected preset at runtime – Determines if the selected preset should override at runtime the current editor settings or not

  • Reset Animation Settings – Resets the current animation settings

  • Loop Animation – @[email protected] – loop animation triggered when the button gets selected (happens only after OnSelected UIButtonBehavior has been triggered)