jakobhellermann / bevy-inspector-egui

Inspector plugin for the bevy game engine
Apache License 2.0
1.15k stars 169 forks source link

Customize inspector window attributes #63

Closed jf908 closed 1 year ago

jf908 commented 2 years ago

Is there a way to customize the inspector's window size, border radius, resizability, etc?

paul-hansen commented 2 years ago

Adding a startup system that sets the egui style worked for me. For example this removes the window shadow and makes the rounding of the corners smaller.

pub fn set_ui_theme(mut ctx: ResMut<EguiContext>) {
    ctx.ctx_mut().set_style(egui::Style {
        visuals: egui::Visuals {
            window_rounding: Rounding::same(1.5),
            window_shadow: Shadow {
                extrusion: 0.0,
                color: Default::default(),
            },
            ..egui::Visuals::dark()
        },
        ..Default::default()
    });
}

You would add that system to your app like this:

app.add_startup_system(set_ui_theme)

Here's the docs for Style to see what you can change: https://docs.rs/egui/0.19.0/egui/style/struct.Style.html

jakobhellermann commented 1 year ago

The crate now exposes functions like ui_for_world so you can easily display it in whatever window you want:

https://github.com/jakobhellermann/bevy-inspector-egui/blob/863191c2fa7898dd451f64b09e77012b7778a26f/crates/bevy-inspector-egui/src/quick.rs#L51-L77