Dynamic Header Scripting Dark Center Band Scripting



The UIToggle is a Core component in the DoozyUI system. It contains all the logic needed for a toggle to work and behave in various ways in order to create complex UI interactions.

Static Properties


  • public CanvasGroup CanvasGroup – Reference to the CanvasGroup component

  • public bool HasLabelTargetLabel.None -> Returns FALSE. TargetLabel.Text and TextLabel != null -> Returns TRUE. TargetLabel.TextMeshPro and TextMeshPro support is enabled and TextMeshProLabel != null -> Returns TRUE

  • public bool Interactable – Returns TRUE if the toggle’s Toggle component is interactable. This also toggles this toggle’s interactability

  • public bool IsOn – Returns TRUE if the Toggle is on and FALSE otherwise. This also toggles this Toggle’s on/off state

  • public bool IsSelected – Returns TRUE if this UIToggle is selected, by checking the EventSystem.current.currentSelectedGameObject

  • public Toggle Toggle – Reference to the Toggle component

  • public bool UpdateStartValuesRequired – If TRUE, the start values get updated when the next interaction happens

Public Variables

  • public bool AllowMultipleClicks – If TRUE, this toggle can be spam clicked and it won’t get disabled. If FALSE, after each click, this toggle will get disabled for DisableButtonBetweenClicksInterval value

  • public float DisableButtonBetweenClicksInterval – If AllowMultipleClicks is FALSE, then this interval determines for how long this toggle gets disabled after each click

  • public bool DeselectButtonAfterClick – If TRUE, after this toggle has been clicked it will get automatically deselected

  • public InputData InputData – Allows the toggle to react to keys or virtual buttons (only when selected)

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

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

  • public UIToggleBehavior OnClick – Behavior when the pointer performs a click over the toggle

  • public UIToggleBehavior OnSelected – Behavior when the toggle gets selected

  • public UIToggleBehavior OnDeselected – Behavior when the toggle gets deselected

  • public BoolEvent OnValueChanged – Callback executed when the value of the toggle has changed

  • public TargetLabel TargetLabel – Determines what type of label this toggle has

  • public Text TextLabel – Reference to the Text component used as a label for this toggle

  • public ~TextMeshProUGUI~ TextMeshProLabel – Reference to the TextMeshProUGUI component used as a label for this toggle. Available only if TextMeshPro support is enabled

  • public Progressor ToggleProgressor – Reference to a Progressor that allows animating anything (texts, images, animations…) when this UIToggle has been toggled

Public Methods

  • public void DeselectToggle() – Deselects this toggle from the EventSystem (if selected)

  • public void DeselectToggle(float delay) – Deselects this toggle from the EventSystem (if selected), after a set delay

  • public void DisableToggle() – Sets Interactable to FALSE

  • public void DisableToggle(float duration) – Disables the toggle for a set time duration

  • public void EnableToggle() – Sets Interactable to TRUE

  • public void ExecutePointerEnter(bool debug = false) – Executes OnPointerEnter actions, if enabled

  • public void ExecutePointerExit(bool debug = false) – Executes OnPointerExit actions, if enabled

  • public void ExecuteClick(bool debug = false) – Executes OnClick actions, if enabled

  • public void ExecuteOnButtonDeselected(bool debug = false) – Executes OnDeselected actions, if enabled

  • public void ExecuteOnButtonSelected(bool debug = false) – Executes OnSelected actions, if enabled

  • public void LoadPresets() – Loads all the preset animations, that are set to be loaded at runtime, for all the enabled behaviors

  • public void NotifySystemOfTriggeredBehavior(UIToggleState toggleState, UIToggleBehaviorType behaviorType) – Sends an UIToggleMessage notifying the system that an UIToggleBehavior has been triggered

  • public void SelectToggle() – Selects this toggle in the EventSystem

  • public void SetLabelText(string text) – If this UIToggle has a label referenced, its text will get updated to the given text value

  • public void ToggleOff() – Toggles the toggle off. IsOn = false

  • public void ToggleOn() – Toggles the toggle on. IsOn = true