Is there a WaitForSeconds as in Unity?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By mateusak
:warning: Old Version Published before Godot 3 was released.

Or any other way to do code after some time other than doing

var Time = 0

func _fixed_process(delta):
   Time += delta
:bust_in_silhouette: Reply From: GlaDOSik

There’s a Timer node. Put him to your scene, use set_wait_time, start() and signal timeout.

I know there is, but that’s even more impractical than the way I said above. If you need to timer two things simultaneously, then you need two Timer nodes. No, thanks. But thank you :stuck_out_tongue:

mateusak | 2016-08-21 19:24

:bust_in_silhouette: Reply From: Mefihl

Nice! But this get_tree().create_timer() will create a Timer node and leave it in the scene tree?

Edit: Just saw this create_timer() function is only for 2.2. Why.

Edit2: I just remembered Godot is a open source engine, allowing me to download the sources and compile 2.2 now. Thanks Godot.

mateusak | 2016-08-21 21:39

:bust_in_silhouette: Reply From: TotCac

Reduz state on FB group that it is possible in last git branch

# Wait 5 seconds, then resume execution (Godot 2.2+)
yield( get_tree().create_timer(5.0), "timeout" )