mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 20:53:53 +00:00
290d6363b8
# 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>
23 lines
1,001 B
Rust
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();
|
|
}
|