Trait bevy::app::Plugin

pub trait Plugin: Downcast + Any + Send + Sync {
    // Required method
    fn build(&self, app: &mut App);

    // Provided methods
    fn setup(&self, _app: &mut App) { ... }
    fn name(&self) -> &str { ... }
    fn is_unique(&self) -> bool { ... }
}
Expand description

A collection of Bevy app logic and configuration.

Plugins configure an App. When an App registers a plugin, the plugin’s Plugin::build function is run. By default, a plugin can only be added once to an App.

If the plugin may need to be added twice or more, the function is_unique() should be overridden to return false. Plugins are considered duplicate if they have the same name(). The default name() implementation returns the type name, which means generic plugins with different type parameters will not be considered duplicates.

Required Methods§

fn build(&self, app: &mut App)

Configures the App to which this plugin is added.

Provided Methods§

fn setup(&self, _app: &mut App)

Runs after all plugins are built, but before the app runner is called. This can be useful if you have some resource that other plugins need during their build step, but after build you want to remove it and send it to another thread.

fn name(&self) -> &str

Configures a name for the Plugin which is primarily used for checking plugin uniqueness and debugging.

fn is_unique(&self) -> bool

If the plugin can be meaningfully instantiated several times in an App, override this method to return false.

Implementations§

§

impl dyn Plugin + 'static

pub fn is<__T>(&self) -> boolwhere __T: Plugin,

Returns true if the trait object wraps an object of type __T.

pub fn downcast<__T>( self: Box<dyn Plugin + 'static, Global> ) -> Result<Box<__T, Global>, Box<dyn Plugin + 'static, Global>>where __T: Plugin,

Returns a boxed object from a boxed trait object if the underlying object is of type __T. Returns the original boxed trait if it isn’t.

pub fn downcast_rc<__T>( self: Rc<dyn Plugin + 'static> ) -> Result<Rc<__T>, Rc<dyn Plugin + 'static>>where __T: Plugin,

Returns an Rc-ed object from an Rc-ed trait object if the underlying object is of type __T. Returns the original Rc-ed trait if it isn’t.

pub fn downcast_ref<__T>(&self) -> Option<&__T>where __T: Plugin,

Returns a reference to the object within the trait object if it is of type __T, or None if it isn’t.

pub fn downcast_mut<__T>(&mut self) -> Option<&mut __T>where __T: Plugin,

Returns a mutable reference to the object within the trait object if it is of type __T, or None if it isn’t.

Implementors§

§

impl Plugin for bevy::a11y::AccessibilityPlugin

§

impl Plugin for AnimationPlugin

§

impl Plugin for AssetPlugin

§

impl Plugin for AudioPlugin

§

impl Plugin for FrameCountPlugin

§

impl Plugin for TaskPoolPlugin

§

impl Plugin for TypeRegistrationPlugin

§

impl Plugin for BlitPlugin

§

impl Plugin for BloomPlugin

§

impl Plugin for Core2dPlugin

§

impl Plugin for Core3dPlugin

§

impl Plugin for FxaaPlugin

§

impl Plugin for MsaaWritebackPlugin

§

impl Plugin for CorePipelinePlugin

§

impl Plugin for TonemappingPlugin

§

impl Plugin for UpscalingPlugin

§

impl Plugin for DiagnosticsPlugin

§

impl Plugin for EntityCountDiagnosticsPlugin

§

impl Plugin for FrameTimeDiagnosticsPlugin

§

impl Plugin for LogDiagnosticsPlugin

§

impl Plugin for SystemInformationDiagnosticsPlugin

§

impl Plugin for GilrsPlugin

§

impl Plugin for GltfPlugin

§

impl Plugin for HierarchyPlugin

§

impl Plugin for InputPlugin

§

impl Plugin for LogPlugin

§

impl Plugin for FogPlugin

§

impl Plugin for MeshRenderPlugin

§

impl Plugin for PbrPlugin

§

impl Plugin for WireframePlugin

§

impl Plugin for CameraPlugin

§

impl Plugin for GlobalsPlugin

§

impl Plugin for MeshPlugin

§

impl Plugin for PipelinedRenderingPlugin

§

impl Plugin for RenderPlugin

§

impl Plugin for ImagePlugin

§

impl Plugin for ViewPlugin

§

impl Plugin for VisibilityPlugin

§

impl Plugin for WindowRenderPlugin

§

impl Plugin for ScenePlugin

§

impl Plugin for ColorMaterialPlugin

§

impl Plugin for Mesh2dRenderPlugin

§

impl Plugin for SpritePlugin

§

impl Plugin for TextPlugin

§

impl Plugin for TimePlugin

§

impl Plugin for TransformPlugin

§

impl Plugin for UiPlugin

§

impl Plugin for WindowPlugin

§

impl Plugin for bevy::winit::accessibility::AccessibilityPlugin

§

impl Plugin for WinitPlugin

§

impl Plugin for ScheduleRunnerPlugin

§

impl<A> Plugin for RenderAssetPlugin<A>where A: RenderAsset,

§

impl<C> Plugin for ExtractComponentPlugin<C, ()>where C: ExtractComponent,

§

impl<C> Plugin for UniformComponentPlugin<C>where C: Component + ShaderType + WriteInto + Clone,

§

impl<M> Plugin for MaterialPlugin<M>where M: Material, <M as AsBindGroup>::Data: PartialEq<<M as AsBindGroup>::Data> + Eq + Hash + Clone,

§

impl<M> Plugin for PrepassPipelinePlugin<M>where M: Material, <M as AsBindGroup>::Data: PartialEq<<M as AsBindGroup>::Data> + Eq + Hash + Clone,

§

impl<M> Plugin for PrepassPlugin<M>where M: Material, <M as AsBindGroup>::Data: PartialEq<<M as AsBindGroup>::Data> + Eq + Hash + Clone,

§

impl<M> Plugin for Material2dPlugin<M>where M: Material2d, <M as AsBindGroup>::Data: PartialEq<<M as AsBindGroup>::Data> + Eq + Hash + Clone,

§

impl<R> Plugin for ExtractResourcePlugin<R>where R: ExtractResource,

§

impl<T> Plugin for AssetCountDiagnosticsPlugin<T>where T: Asset,

§

impl<T> Plugin for ValidParentCheckPlugin<T>where T: Component,

§

impl<T> Plugin for CameraProjectionPlugin<T>where T: CameraProjection + Component + GetTypeRegistration,