3 releases

0.14.2 Aug 6, 2024
0.14.1 Aug 6, 2024
0.14.0 Aug 6, 2024

#607 in Game dev

MIT/Apache

30KB
104 lines

bevy_debug_panel

add debug info to screen

examples

Quickstart

simple show framerate example

use bevy::diagnostic::{DiagnosticsStore, FrameTimeDiagnosticsPlugin};
use bevy::prelude::*;
use bevy_debug_panel::prelude::*;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_plugins(DebugPanelPlugin)
        .add_plugins(FrameTimeDiagnosticsPlugin)
        .add_systems(Startup, setup)
        .add_systems(Update, show_fps)
        .run();
}

fn setup(mut commands: Commands) {
    commands.spawn(Camera2dBundle { ..default() });
}

fn show_fps(diagnostics: Res<DiagnosticsStore>, mut debug_res: ResMut<DebugResource>) {
    if let Some(value) = diagnostics
        .get(&FrameTimeDiagnosticsPlugin::FPS)
        .and_then(|fps| fps.smoothed())
    {
        debug_res.insert("Fps", format!("{:.2}", value));
    }
}

compatible bevy versions

bevy bevy_debug_panel
0.14 0.14

Dependencies

~38–75MB
~1.5M SLoC