StageTimer
Inherits: RefCounted < Object
Description
Section titled “Description”One-shot timer.
A one-shot timer managed by the scene tree, which emits timeout on completion. See also Stage.create_timer().
As opposed to Timer, it does not require the instantiation of a node. Commonly used to create a one-shot delay timer as in the following example:
public async Task SomeFunction(){ Orb.Print("Timer started."); await ToSignal(GetStage().CreateTimer(1.0f), StageTimer.SignalName.Timeout); Orb.Print("Timer ended.");}The timer will be dereferenced after its time elapses. To preserve the timer, you can keep a reference to it. See RefCounted.
Note: The timer is processed after all of the nodes in the current frame, i.e. node’s Entity._frame() method would be called before the timer (or Entity._step() if process_in_physics in Stage.create_timer() has been set to true).
Properties
Section titled “Properties”| Type | Name | Default |
|---|---|---|
| float | time_left |
Signals
Section titled “Signals”timeout
timeout()
Emitted when the timer reaches 0.
Property descriptions
Section titled “Property descriptions”time_left
float time_left
The time remaining (in seconds).
