Skip to content

Components

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

FieldScript nameKindDefaultWhat it does
Wait Timewait_timenumber, at least 0, step 0.051 sSeconds between firings; zero never fires.
One Shotone_shotcheckboxoffFire once and stop, instead of starting the next period.
AutostartautostartcheckboxonStart counting on the first step this node processes.
PausedpausedcheckboxoffHold the countdown where it is.
Time Lefttime_leftnumber, read-only0 sZero means stopped.