-
Notifications
You must be signed in to change notification settings - Fork 123
Description
Versions
What versions of Godot do you want to use this feature in?
4.3+
The Feature
wait_idle_frames()
Currently wait_frame()
is implemented top of a physics process, which is less or more related to IDLE frames handled in _process()
. Physics frame ticks are also dependent on project settings (physics/common/physics_ticks_per_second
, physics/common/max_physics_steps_per_frame
and probably physics/common/physics_jitter_fix
).
As a result, to wait for IDLE frame you don't know how much physics frames you must wait, so you're sticking with a wait_seconds()
, slowing down your tests and praying that one IDLE frame will take less than one second.
The proposal is about adding awaiter for exact idle frames. When I want wait for a two IDLE frames, I should call:
await wait_idle_frames(2)
.
Possible implementation
func wait_idle_frames(frames):
while frames > 0:
await Engine.get_main_loop().process_frame
frames -= 1
Thank you.
TBH: if not really needed, it would be better to implement awaiters on _process
than _physics_process
.