| 1 |
|
| 2 |
|
| 3 |
use bevy::{ |
| 4 |
diagnostic::{ |
| 5 |
Diagnostic, DiagnosticPath, Diagnostics, LogDiagnosticsPlugin, RegisterDiagnostic, |
| 6 |
}, |
| 7 |
prelude::*, |
| 8 |
}; |
| 9 |
|
| 10 |
fn main() { |
| 11 |
App::new() |
| 12 |
.add_plugins(( |
| 13 |
DefaultPlugins, |
| 14 |
|
| 15 |
|
| 16 |
LogDiagnosticsPlugin::default(), |
| 17 |
)) |
| 18 |
|
| 19 |
.register_diagnostic(Diagnostic::new(SYSTEM_ITERATION_COUNT).with_suffix(" iterations")) |
| 20 |
.add_systems(Update, my_system) |
| 21 |
.run(); |
| 22 |
} |
| 23 |
|
| 24 |
|
| 25 |
const SYSTEM_ITERATION_COUNT: DiagnosticPath = DiagnosticPath::const_new("system_iteration_count"); |
| 26 |
|
| 27 |
fn my_system(mut diagnostics: Diagnostics) { |
| 28 |
|
| 29 |
diagnostics.add_measurement(&SYSTEM_ITERATION_COUNT, || 10.0); |
| 30 |
} |