From ebee953955863c7d7d5cb809164b36c5746075bc Mon Sep 17 00:00:00 2001 From: Robert Garrett Date: Sun, 21 Dec 2025 16:41:53 -0600 Subject: [PATCH] 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. --- src/main.rs | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/main.rs b/src/main.rs index 461bb08..507c30f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,20 +1,28 @@ 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 { - primary_window: Some(Window { - canvas: Some("#game-canvas".to_owned()), - resolution: WindowResolution::new(WINDOW_SIZE.0, WINDOW_SIZE.1), - ..default() - }), + 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), ..default() - })) - .add_plugins(AsteroidPlugin) - .add_plugins(EguiPlugin::default()) + }), + ..default() + })) + .add_plugins(AsteroidPlugin); + + #[cfg(feature = "debug_ui")] + app.add_plugins(EguiPlugin::default()) .add_plugins(WorldInspectorPlugin::new()) - .run(); + .add_plugins(RapierDebugRenderPlugin::default()); + + app.run(); }