-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow Timer nodes to ignore engine time scale #96626
Conversation
87b2fad
to
9baae4c
Compare
9baae4c
to
1e6e24e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Documentation is completely fine. Now it's worth questioning if this is the way to go.
To be clear, this PR is only to bring If a rework of both nodes is to be planned sometime soon, then indeed this PR might not be needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Overall, this change makes sense to me.
I haven't tested it, but I did compare the implementation with SceneTreeTimer
and they work the same.
1e6e24e
to
483c134
Compare
Thanks! |
Sometimes, you don't want the
Timer
nodes to be impacted by theEngine.time_scale
setting. This would be the case for example when you want to make HTTP calls to a server at regular intervals, without being affected by the time scale.This PR adds the possibility to ignore
Engine.time_scale
inTimer
nodes.Note that this feature is already present when using
SceneTreeTimer create_timer(time_sec: float, process_always: bool = true, process_in_physics: bool = false, ignore_time_scale: bool = false)
But
SceneTreeTimer
is only one_shot, and thus cannot be an alternative solution when you need to run a function at regular intervals.Testing this PR should be pretty straight forward.
1 - Add a
Node2D
, with aLabel
andTimer
nodes as children2 - Give the
Timer
something like 100 seconds wait time3 - Add the script below
4 - Run the game, then check & uncheck the
Ignore Time Scale
from the editor to see the differenceAdd improved support for unscaled time godot-proposals#7775
and Add a time_scale modifier to Timer scene for independent time control godot-proposals#10373.