bevy_time::common_conditions

Function repeating_after_delay

Source
pub fn repeating_after_delay(
    duration: Duration,
) -> impl FnMut(Res<'_, Time>) -> bool + Clone
Expand description

Run condition that is active indefinitely after the specified delay, using Time to advance the timer. The timer ticks at the rate of Time::relative_speed.

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_systems(
            Update,
            tick.run_if(repeating_after_delay(Duration::from_secs(1))),
        )
    .run();
}
fn tick() {
    // ran every frame, after a second
}