bevy/examples/diagnostics/log_diagnostics.rs
l1npengtul 290d6363b8 add system information plugin and update relevant examples (#5911)
# Objective
Solve #5464 

## Solution
Adds a `SystemInformationDiagnosticsPlugin` to add diagnostics.

Adds `Cargo.toml` flags to fix building on different platforms. 

---

## Changelog

Adds `sysinfo` crate to `bevy-diagnostics`. 

Changes in import order are due to clippy.

Co-authored-by: l1npengtul <35755164+l1npengtul@users.noreply.github.com>
Co-authored-by: IceSentry <c.giguere42@gmail.com>
2023-01-02 20:49:43 +00:00

23 lines
1,001 B
Rust

//! Shows different built-in plugins that logs diagnostics, like frames per second (FPS), to the console.
use bevy::{
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
prelude::*,
};
fn main() {
App::new()
.add_plugins(DefaultPlugins)
// Adds frame time diagnostics
.add_plugin(FrameTimeDiagnosticsPlugin::default())
// Adds a system that prints diagnostics to the console
.add_plugin(LogDiagnosticsPlugin::default())
// Any plugin can register diagnostics
// Uncomment this to add an entity count diagnostics:
// .add_plugin(bevy::diagnostic::EntityCountDiagnosticsPlugin::default())
// Uncomment this to add an asset count diagnostics:
// .add_plugin(bevy::asset::diagnostic::AssetCountDiagnosticsPlugin::<Texture>::default())
// Uncomment this to add system info diagnostics:
// .add_plugin(bevy::diagnostic::SystemInformationDiagnosticsPlugin::default())
.run();
}