scene_add_button
Adds a clickable on-screen interaction button to a copied save and returns its control group index so pressing its key raises the whenUiControlGroupIsTriggered event in the player template graph.
Instructions
Put an interaction button (交互按钮) on the screen in a copy of a save: a round button the player clicks (or presses with its key), at any time and anywhere, unlike an option tab that needs the character next to something. Pressing it raises whenUiControlGroupIsTriggered in a graph on the player template (scene_add_graph attachToPrefab "player"); evt.eventSourceEntity is the player that pressed, and evt.uiControlGroupIndex is the controlGroupIndex this tool returns for the button. position is [x, y] from the screen centre on a 1600 x 900 canvas, y up; size [width, height]; key is the number key that presses it (1 by default: give each button its own). On a computer the button is pressed with its key, which is shown under it: the mouse cursor belongs to the camera during play. The button has the editor's default settings otherwise (no cooldown, no use limit, the default icon, a question mark); with key 1 the three records written are byte for byte those of the button in the official sample 界面控件. Verified in play on 2026-10-11 (examples/buttons): two buttons, keys 1 and 2, each raised the event with its own index, on an account of 奇匠 level 1. Writes a new .gil in the workspace; the official save is not touched.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | No | ||
| name | Yes | ||
| size | No | ||
| mapPath | No | ||
| position | No | ||
| outputName | No |