#[auto_component]Expand description
Automatically registers item as Component for bevy app. (See below for additional options) Automatically registers a component to be added to the app.
§Parameters
plugin = PluginType- Required. Specifies which plugin should register this component.generics(T1, T2, ...)- Optional. Specifies concrete types for generic parameters. When provided, the component will be registered with these specific generic parameters.derive|derive(Debug, Default, ..)- Optional. Specifies that the macro should handle derivingComponent. Passes through any additional derives listed.reflect|reflect(Debug, Default, ..)- Optional. Specifies that the macro should handle emitting the single#[reflect(...)]. Passes through any additional reflects listed. If enabled in tandem withderiveit also includes#[derive(Reflect)]register- Enables type registration for theComponentSame as having#[auto_register_type]auto_name | auto_name = ...- Enables adding a required component ofNamewith theComponent’s concrete name or custom name literal if specified. Same as having#[auto_name]or#[auto_name = ...]
§Example
use bevy::prelude::*;
use bevy_auto_plugin::prelude::*;
#[derive(AutoPlugin)]
#[auto_plugin(impl_plugin_trait)]
struct MyPlugin;
#[auto_component(plugin = MyPlugin, derive(Debug, Default, PartialEq), reflect, register, auto_name)]
struct FooComponent(usize);§Example (with generics)
use bevy::prelude::*;
use bevy_auto_plugin::prelude::*;
#[derive(AutoPlugin)]
#[auto_plugin(impl_plugin_trait)]
struct MyPlugin;
#[auto_component(plugin = MyPlugin, generics(usize), derive(Debug, Default, PartialEq), reflect, register)]
struct FooComponentWithGeneric<T>(T);