Godot Version
Godot v4.7.2
Question
func _process(delta):
await get_tree().create_timer(1).timeout
print("Test")
How would i make this function such that the await line runs more than once, without using a Timer node (doing this in a global function). Whenever i try this, the await line runs the first time, but doesnt repeat.
Umm, never await in perpetual callbacks like _process(). What exactly are you trying to achieve?
As @normalized said, don’t try to use await, and especially not in the _process function.
But if you absolutely must do this and want to go this way, make this a separate function like:
func wait(timeToWait: float):
return get_tree().create_timer(timeToWait).timeout
Which then you can call like this:
func _ready() -> void:
await wait(3);
print("Done!")
I assume you just want to do this to shorten the timer creation, but I would recommend NOT using await anywhere and just connect / disconnect signals.