How to I create a one-shot timer?

Question

How do I create a timer that doesn’t repeat so I can wait a certain amount of time exactly once without creating a Timer node?

Use SceneTree’s create_timer method and use the timeout property of the newly-created SceneTreeTimer.

func some_function():
    print("Timer started.")
    await get_tree().create_timer(1.0).timeout
    print("Timer ended.")

History