Tainted\\Coders

Log FPS to console

Bevy version: 0.14Last updated:

Use FrameTimeDiagnosticsPlugin to add the information to the diagnostics. Use LogDiagnosticsPlugin to output the diagnostics to the console. You can use bevy::diagnostic::* for some built in diagnostics info to be added.

use bevy::{
  diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
  prelude::*,
};

fn main() {
  App::new()
    .add_plugins(DefaultPlugins)
    // Adds frame time diagnostics
    .add_plugins(FrameTimeDiagnosticsPlugin::default())
    // Adds a system that prints diagnostics to the console
    .add_plugins(LogDiagnosticsPlugin::default())
    // Any plugin can register diagnostics
    // Uncomment this to add an entity count diagnostics:
    // .add_plugins(bevy::diagnostic::EntityCountDiagnosticsPlugin::default())
    // Uncomment this to add an asset count diagnostics:
    // .add_plugins(bevy::asset::diagnostic::AssetCountDiagnosticsPlugin::<Texture>::default())
    // Uncomment this to add system info diagnostics:
    // .add_plugins(bevy::diagnostic::SystemInformationDiagnosticsPlugin::default())
    .run();
}