Timer
A countdown on a node: a door that swings shut a few seconds later, a vent that lets something out on a fixed interval, a search that gives up. The script on its node hears each firing, and can start and stop it.
On this page
Add it
Add component → TimerComponent in the Inspector, on the node that should carry it.
From a script
A script on the same node writes these fields by name. TimerComponent is the name to pass.
rgs
set_number("TimerComponent", "wait_time", 1.0);
set_flag("TimerComponent", "one_shot", false);
set_flag("TimerComponent", "autostart", true);
set_flag("TimerComponent", "paused", false); Fields
| Field | Script name | Kind | Default | What it does |
|---|---|---|---|---|
| Wait Time | wait_time | number, at least 0, step 0.05 | 1 s | Seconds between firings; zero never fires. |
| One Shot | one_shot | checkbox | off | Fire once and stop, instead of starting the next period. |
| Autostart | autostart | checkbox | on | Start counting on the first step this node processes. |
| Paused | paused | checkbox | off | Hold the countdown where it is. |
| Time Left | time_left | number, read-only | 0 s | Zero means stopped. |