creating plugins
Most plugins are simply functions that add configuration to an App.
App::new().add_plugins(my_plugin).run();
// This function implements `Plugin`, along with every other `fn(&mut App)`.
pub fn my_plugin(app: &mut App) {
app.add_systems(Update, hello_world);
}
For more advanced use cases, the Plugin trait can be implemented manually for a type.
pub struct AccessibilityPlugin {
pub flicker_damping: bool,
// ...
}
impl Plugin for AccessibilityPlugin {
fn build(&self, app: &mut App) {
if self.flicker_damping {
app.add_systems(PostUpdate, damp_flickering);
}
}
}
using plugins
.add_plugins(DefaultPlugins)
DefaultPlugins
Contains all the plugins typically required to build a Bevy application which
includes a window and presentation components. For the absolute minimum number
of plugins needed to run a Bevy application you may with to use MinimalPlugins.