Attribute Macro auto_plugin

Source
#[auto_plugin]
Expand description

Attaches to a module and generates an initialization function that automatically registering types, events, and resources in the App.

ยงExample

use bevy::prelude::*;
use bevy_auto_plugin::auto_plugin_module::*;

#[auto_plugin(init_name=init)]
pub mod my_plugin {
    use super::*;

    #[auto_register_type]
    #[derive(Component)]
    pub struct MyComponent;

    // code gen:
    pub(super) fn init(app: &mut App) {  
        app.register_type::<MyComponent>();
    }
}

fn plugin(app: &mut App) {
    app.add_plugin(my_plugin::init)
}