Hide egui-inspector window behind feature flag

The World Inspector widget shouldn't be enabled by default. This hides
it behind the "debug_ui" feature flag, along with the bevy_rapier2d
debug drawings.

The bevy_rapier2d debug plugin is now added when in debug mode, which
was not previously the case.
This commit is contained in:
2025-12-21 16:41:53 -06:00
parent d2cb75c3a1
commit ebee953955

View File

@@ -1,11 +1,15 @@
use bevy::{prelude::*, window::WindowResolution};
use asteroids::{AsteroidPlugin, config::WINDOW_SIZE};
#[cfg(feature = "debug_ui")]
use bevy_inspector_egui::{bevy_egui::EguiPlugin, quick::WorldInspectorPlugin};
#[cfg(feature = "debug_ui")]
use bevy_rapier2d::render::RapierDebugRenderPlugin;
fn main() {
App::new()
.add_plugins(DefaultPlugins.set(WindowPlugin {
let mut app = App::new();
app.add_plugins(DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window {
canvas: Some("#game-canvas".to_owned()),
resolution: WindowResolution::new(WINDOW_SIZE.0, WINDOW_SIZE.1),
@@ -13,8 +17,12 @@ fn main() {
}),
..default()
}))
.add_plugins(AsteroidPlugin)
.add_plugins(EguiPlugin::default())
.add_plugins(AsteroidPlugin);
#[cfg(feature = "debug_ui")]
app.add_plugins(EguiPlugin::default())
.add_plugins(WorldInspectorPlugin::new())
.run();
.add_plugins(RapierDebugRenderPlugin::default());
app.run();
}