Actions: make buttons do things
Triggers and actions: go to screens, show and hide things, change variables, and more.
Actions make your UI do things. "When the player clicks Play, go to Level Select." "When the pause button is clicked, open the pause menu." You set them up in the Actions tab, without code.
How an action is built
Every interaction has two parts:
- A trigger: when it happens, such as On Click.
- One or more actions: what happens, such as Navigate to a screen.
Add your first action
- Select a button.
- Open the Actions tab on the right.
- Click Add Interaction.
- Leave the trigger on On Click.
- Change the action to Navigate, then pick the target screen.
- Optional: choose a Transition, like Cross-fade or Slide in from right, and click Preview to see it.
Press Play and click the button to try it.
Triggers
Trigger · When it runs
On Click · The element is clicked or tapped On Hover Enter / Exit · The mouse moves onto or off it On Press / On Release · The finger or mouse button goes down or comes up When Switched ON / OFF, When Toggle Changes · Toggles and checkboxes On Value Changed, When Tab Changes, When Slide Changes… · Bars, dropdowns, tabs, carousels and lists
Actions
Action · What it does
Navigate · Goes to another screen, with an optional transition Show / Hide / Toggle Visibility · Shows or hides an element or a group Enable / Disable · Lets the player use an element, or greys it out Open Popup / Close Popup · Opens or closes a group made into a popup Back · Closes the top popup, or goes to the previous screen Play Animation · Plays one of the element's animations Set Variable · Sets, adds to or flips a variable (coins, sound on…) Play Sound · Plays a sound Show Toast · Shows a short message, like "+50 coins" Select Element · Moves the gamepad / keyboard highlight to an element Set Language · Switches the game to another language
Several actions at once
Click + Add Action inside an interaction to add more steps. They run in order. For example, a "Claim" button can Set Variable (coins + 100), Show Toast ("+100 coins") and then Navigate back to the main menu.
Only sometimes: conditions
Click Add condition to run the actions only when something is true, for example only when coins is at least 500. If the condition is false, nothing happens.
Targets
Many actions need a target:
- Self: the element you are editing.
- Instance: another element.
- Group: a group of elements (see Popups and toasts).
- Screen: for Navigate.
Warning: If you delete the element or screen an action points to, the action is marked with a warning and skipped. Open the Actions tab and pick a new target.
In Unity
Your actions are exported too. In Unity they run on their own, with no code needed. When you do want code, you can listen to the same clicks from your scripts. See Connect the UI to your game code.