diff --git a/crates/bevy_app/src/plugin_group.rs b/crates/bevy_app/src/plugin_group.rs index 074a2d3083cd2..19998e561e5ca 100644 --- a/crates/bevy_app/src/plugin_group.rs +++ b/crates/bevy_app/src/plugin_group.rs @@ -78,6 +78,18 @@ impl PluginGroupBuilder { self } + pub fn reconfigure(&mut self, plugin: T) -> &mut Self { + self.plugins.remove(&TypeId::of::()); + self.plugins.insert( + TypeId::of::(), + PluginEntry { + plugin: Box::new(plugin), + enabled: true, + }, + ); + self + } + pub fn enable(&mut self) -> &mut Self { let mut plugin_entry = self .plugins diff --git a/examples/app/plugin_group.rs b/examples/app/plugin_group.rs index 7e0be8143b6b3..09c0dc44a0aaa 100644 --- a/examples/app/plugin_group.rs +++ b/examples/app/plugin_group.rs @@ -13,6 +13,14 @@ fn main() { // .disable::() // .add_before::(bevy::diagnostic::LogDiagnosticsPlugin::default()) // }) + // Modifications can also include replacing the default configuration of a specific plugin: + // .add_plugins_with(DefaultPlugins, |group| { + // group + // .reconfigure(bevy::window::WindowPlugin { + // exit_on_close: false, + // ..Default::default() + // }) + // }) .run(); }