-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
time.delta() not compatible with .run_if() and timer conditions #8800
Copy link
Copy link
Closed
Labels
A-TimeInvolves time keeping and reportingInvolves time keeping and reportingC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behavior
Description
Bevy version
0.10.1
What you did
use bevy::{
prelude::*,
utils::Duration,
time::{common_conditions::*},
};
use text_colorizer::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_system(system_foo.run_if(on_timer(Duration::from_secs_f32(2.5))))
.run();
}
fn system_foo(time: Res<Time>) {
println!("{}: Seconds since last update: {}","foo".blue() , time.delta().as_secs_f64());
println!("FPS: {}", 1.0 / time.delta().as_secs_f64());
}What went wrong
Maybe this is expected behavior, but in the given example
time.delta() shows the wrong delta, but visually the console output appears correctly every ~2.5 seconds.
I would expect time.delta() to be close to the configured 2.5 seconds, too.
In my case the console outputs:
foo: Seconds since last update: 0.00117275
FPS: 852.6966531656363
foo: Seconds since last update: 0.001393651
FPS: 717.5397570840906
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-TimeInvolves time keeping and reportingInvolves time keeping and reportingC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behavior