Tainted\\Coders

Log FPS to console

Bevy version: 0.19Last 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.

Each of these plugins will enhance your console with detailed debug information.

use bevy::{
  app::App,
  diagnostic::{
    EntityCountDiagnosticsPlugin,
    FrameTimeDiagnosticsPlugin,
    LogDiagnosticsPlugin,
    SystemInformationDiagnosticsPlugin,
  },
  prelude::*,
};

pub fn debug_plugin(app: &mut App) {
  app.add_plugins((
    LogDiagnosticsPlugin::default(),
    FrameTimeDiagnosticsPlugin::default(),
    EntityCountDiagnosticsPlugin::default(),
    SystemInformationDiagnosticsPlugin,
  ));
}

fn main() {
  App::new()
    .add_plugins(DefaultPlugins)
    .add_plugins(debug_plugin)
    .run();
}