Candy Logo Copyright © 2025-2026 Candy Arts

Button UI
The Button UI displays one choice inside a category. See Choice Menus for how menus are built.
  • Script: Choice_Button.gd
  • Templates: Scenes/Choice_Buttons
  • Updates: the script is 'unsafe', and so is every template except Default.tscn (see Customizing UI Elements, on the UI page)
Nodes
VariableNode
choice_buttonRequired. The node the player interacts with to select the choice, such as a Button.
choice_labelRequired. The node displaying the choice's label, through its text property: a Button, Label or RichTextLabel.
choice_tooltipRequired. The node displaying the choice's tooltip, through its tooltip_text property: any Control.
The same node can fill several roles: in the templates, a single Button is the button, label and tooltip. Selecting the choice Connect the choice_button's signal (e.g. pressed) to the script's _choice_selected() function. Nothing else is required: _choice_selected() sends the selection to the Engine. The templates already contain this connection. A selection while the Dialogue is suspended is ignored. Customizable Functions These functions are in the UI Element's script, an 'unsafe' file. To change them, work in a copy of the script, attached to your own scenes, or updates will overwrite your changes (see Customizing UI Elements, on the UI page). A choice can be enabled or disabled, active or inactive, and visible or invisible (see Choice_List and Choice_Status). These functions are called when the button is initialized, and again whenever one of these states changes. Write your own code in them to display the state:
FunctionState / Default
_toggle_enabled()choice_enabled (1 or 0). Empty by default: for example, gray out a disabled choice.
_toggle_active()choice_active (1 or 0). Empty by default.
_toggle_invisible()choice_invisible (1 or 0). Displays or hides the button.
setup(custom_data) runs all three, after setting the label and tooltip. custom_data is [[menu values], [category values], [choice values]]: the Custom Data of the Choice_List command, of the choice's category, then of the choice. refresh_language() is called when the button's category is asked to display its texts again in a new language. It sets the label and tooltip again (see Translating UI Texts).