Click or drag to resize

SceneTreeCreateTimer Method

Returns a SceneTreeTimer which will SceneTreeTimer.timeout after the given time in seconds elapsed in this SceneTree. If pause_mode_process is set to false, pausing the SceneTree will also pause the timer.

Commonly used to create a one-shot delay timer as in the following example:

func some_function():
    print("start")
    yield(get_tree().create_timer(1.0), "timeout")
    print("end")

The timer will be automatically freed after its time elapses.

Namespace:  Godot
Assembly:  GodotSharp (in GodotSharp.dll) Version: 1.0.0
Syntax
C#
public SceneTreeTimer CreateTimer(
	float timeSec,
	bool pauseModeProcess = true
)

Parameters

timeSec
Type: SystemSingle

[Missing <param name="timeSec"/> documentation for "M:Godot.SceneTree.CreateTimer(System.Single,System.Boolean)"]

pauseModeProcess (Optional)
Type: SystemBoolean

[Missing <param name="pauseModeProcess"/> documentation for "M:Godot.SceneTree.CreateTimer(System.Single,System.Boolean)"]

Return Value

Type: SceneTreeTimer

[Missing <returns> documentation for "M:Godot.SceneTree.CreateTimer(System.Single,System.Boolean)"]

See Also