|Topic was automatically imported from the old Question2Answer platform.
Can someone tell me about the meaning of “idle” in the documentation. Idle processing mean the _process tick, so i think that idle time must be the next _process call? Am I correct?
So call_deferred is just a queue of methods that will be invoked in the next _process frame? That method seems so magical to me, almost all the guide/examples in the documentation seems use that method to wrap another method to achieve the safeness.
And, if i use godot, should i wrap every method call inside call_deferred to achive the “safety” without worrying about anything? The documentation about call_deferred is so short but its used so widely
From what I understand, the
_process function called every idle step, and the engine attempts to meet some desired target frames per second, but does not enforce it, so the
delta time passed as an argument to
_process may not be exactly 1/60 of a second, assuming 60 FPS.
call_deferred is called after (or maybe before, however you want to interpret it) the idle step.
I am no expert, but an example of a reason why
call_deferred is safe is because it waits briefly before executing a function call, and for tasks such as collision handling using the
area_exited signals from
Area2Ds, when the collision processing is being done you cannot alter collision properties of areas (for example disabling collision shapes). To disable a collision shape in response to a collision being detected, you must wait and disable the shape during the idle step (which can be accomplished via
So for your question about using
call_deferred for everything, just to be safe, I don’t think you have to. If you are doing simple computations (iterating over child nodes or changing property values, for example), you don’t need
IIRC, isn’t collision things are physics related? So it’s more related to the _physic processing than the idle processing, why call_deferred still work in that case. I think the “idle time” in the method’s documentation is not really related to the “idle processing” page also from the docs?
nganhvu | 2023-03-27 22:37