Struct Timer

A countdown timer.

struct Timer ;

Counts down a specified interval and emits a signal on reaching 0. Can be set to repeat or "one-shot" mode.

Properties

NameTypeDescription
autostart[get, set] boolIf true, the timer will automatically start when entering the scene tree. Note: This property is automatically set to false after the timer enters the scene tree and starts.
oneShot[get, set] boolIf true, the timer will stop when reaching 0. If false, it will restart.
paused[get, set] boolIf true, the timer is paused and will not process until it is unpaused again, even if start is called.
processMode[get, set] Timer.TimerProcessModeProcessing mode. See timerprocessmode.
timeLeft[get] doubleThe timer's remaining time in seconds. Returns 0 if the timer is inactive. Note: You cannot set this value. To change the timer's remaining time, use start.
waitTime[get, set] doubleWait time in seconds.

Methods

NameDescription
getTimeLeft
getTimerProcessMode
getWaitTime
hasAutostart
isOneShot
isPaused
isStopped Returns true if the timer is stopped.
setAutostart
setOneShot
setPaused
setTimerProcessMode
setWaitTime
start Starts the timer. Sets wait_time to time_sec if time_sec > 0. This also resets the remaining time to wait_time. Note: this method will not resume a paused timer. See paused.
stop Stops the timer.

Enums

NameDescription
Constants
TimerProcessMode