pub fn on_fixed_timer(duration: Duration) -> impl FnMut(Res<'_, FixedTime>)
Expand description

Run condition that is active on a regular time interval, using FixedTime to advance the timer.

If used for a non-fixed timestep system, use on_timer instead.

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_system(
            tick.in_schedule(CoreSchedule::FixedUpdate)
                .run_if(on_fixed_timer(Duration::from_secs(1))),
        )
        .run();
}
fn tick() {
    // ran once a second
}

Note that this run condition may not behave as expected if duration is smaller than the fixed timestep period, since the timer may complete multiple times in one fixed update.