Skip to content

Commit b8e9d90

Browse files
committed
fix
1 parent 4a5a1e1 commit b8e9d90

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/main.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -483,18 +483,20 @@ fn diagnostics_text_update_system(
483483
diagnostics: Res<DiagnosticsStore>,
484484
mut query: Query<&mut Text, With<DiagnosticsText>>,
485485
) {
486-
let fps = if let Some(fps) = diagnostics.get(&FrameTimeDiagnosticsPlugin::FPS) {
487-
if let Some(value) = fps.smoothed() {
488-
format!("{value:.2}")
486+
if diagnostics.is_changed() {
487+
let fps = if let Some(fps) = diagnostics.get(&FrameTimeDiagnosticsPlugin::FPS) {
488+
if let Some(value) = fps.smoothed() {
489+
format!("{value:.2}")
490+
} else {
491+
"N/A".to_string()
492+
}
489493
} else {
490494
"N/A".to_string()
491-
}
492-
} else {
493-
"N/A".to_string()
494-
};
495+
};
495496

496-
let entity_count =
497-
if let Some(entity_count) = diagnostics.get(&EntityCountDiagnosticsPlugin::ENTITY_COUNT) {
497+
let entity_count = if let Some(entity_count) =
498+
diagnostics.get(&EntityCountDiagnosticsPlugin::ENTITY_COUNT)
499+
{
498500
if let Some(value) = entity_count.value() {
499501
format!("{value:.0}")
500502
} else {
@@ -504,7 +506,6 @@ fn diagnostics_text_update_system(
504506
"N/A".to_string()
505507
};
506508

507-
if diagnostics.is_changed() {
508509
for mut span in &mut query {
509510
**span = format!("entity_count: {entity_count} FPS: {fps}");
510511
}

0 commit comments

Comments
 (0)