Skip to content

Commit

Permalink
Run diagnostics only if connected
Browse files Browse the repository at this point in the history
  • Loading branch information
Shatur committed Nov 27, 2024
1 parent 4cc6d32 commit c9c4772
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/client/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use bevy::{
};

use super::{ClientReplicationStats, ClientSet};
use crate::core::replicon_client::RepliconClient;
use crate::core::{common_conditions::client_connected, replicon_client::RepliconClient};

/// Plugin to write [`Diagnostics`] based on [`ClientReplicationStats`] every second.
///
Expand All @@ -17,7 +17,9 @@ impl Plugin for ClientDiagnosticsPlugin {
app.init_resource::<ClientReplicationStats>()
.add_systems(
PreUpdate,
Self::add_measurements.in_set(ClientSet::Diagnostics),
Self::add_measurements
.in_set(ClientSet::Diagnostics)
.run_if(client_connected),
)
.register_diagnostic(
Diagnostic::new(Self::RTT)
Expand Down

0 comments on commit c9c4772

Please sign in to comment.