When Clicked
Fires when the player presses and releases a UI button in one quick click.
Introduction
When Clicked is an event in the Button group of UI Events. It fires when the player presses and releases a UI button in one quick click. When it fires, the event hands the player to your script, so you know exactly who interacted. Like every event, it does nothing by itself. It waits for the right moment, then runs all the actions connected to it. A click is a complete gesture: When Pressed catches the finger going down and When Release catches it coming up, while this event only fires when both happen on the same button - which makes it the safest choice for menus and confirmations. Build and style the receiver with the UI Button guide. When Clicked event in the UI Editor Image The When Clicked event in the UI Editor. caption When Button is Clicked, fires when the player clicks a UI button. This event is attached to: the Button widget inside a UI panel. It belongs to the "Button" group because its home is a UI widget, not a 3D object in the game world.
Parameters
Player the player who clicked the button Parameter Description
How to Access
How to Access - When Clicked
Example
When Clicked event with Show Message and Start Round actions when-button-clicked-example.webp Example: the button adds a small speed boost to the player every time it is clicked. caption
How to Use
Select the Button element and open its properties, then find its component block. Check that the When Clicked event is listed in the block; if it is hidden, press the three dots (...) at the top right of the block and check it in the pop-up list. Press Scripts + next to When Clicked , then add the actions that should run when the event fires: what should run when the button is clicked, such as opening a panel or starting a round. Send follow-up actions to the player parameter when they only affect the player who clicked. Press Play and click the button to confirm the actions run once per click.
Common Uses
Open menus, panels, or dialogs from a single click Confirm purchases, upgrades, or settings changes Start or restart a round from a lobby button
Tip
If the button should react only to a full press and release, keep using When Clicked. Switch to When Pressed when the moment of pressing down matters, like charged actions.