| 1 |
|
| 2 |
|
| 3 |
use std::time::Duration; |
| 4 |
|
| 5 |
use bevy::{ |
| 6 |
diagnostic::{DiagnosticsStore, FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}, |
| 7 |
prelude::*, |
| 8 |
time::common_conditions::on_timer, |
| 9 |
}; |
| 10 |
|
| 11 |
fn main() { |
| 12 |
App::new() |
| 13 |
.add_plugins(( |
| 14 |
DefaultPlugins, |
| 15 |
FrameTimeDiagnosticsPlugin::default(), |
| 16 |
LogDiagnosticsPlugin::default(), |
| 17 |
)) |
| 18 |
.add_systems( |
| 19 |
Update, |
| 20 |
toggle.run_if(on_timer(Duration::from_secs_f32(10.0))), |
| 21 |
) |
| 22 |
.run(); |
| 23 |
} |
| 24 |
|
| 25 |
fn toggle(mut store: ResMut<DiagnosticsStore>) { |
| 26 |
for diag in store.iter_mut() { |
| 27 |
info!("toggling diagnostic {}", diag.path()); |
| 28 |
diag.is_enabled = !diag.is_enabled; |
| 29 |
} |
| 30 |
} |