Bevy Auto Plugin
Bevy Auto Plugin provides attribute macros that automatically handle the repetitive setup usually required in Bevy plugins. Instead of manually wiring up components, resources, events, states, and systems - and remembering all their respective derives - you can declare them with concise annotations tied to a plugin.
If you’ve ever added several components only to hit runtime errors or discover a missing TypeRegistry entry when using tools like bevy-inspector-egui, this plugin is for you.
It helps keep your code focused on game logic rather than framework plumbing.
The following examples demonstrate how common Bevy patterns can be expressed more ergonomically with #[auto_*] macros, while still generating the underlying bevy-specific code you would normally write by hand.
Examples
Basic
Component
instead of having to specify all these derives and remember to reflect:
;
and then later having to remember to register your component in the type registry:
;
you can do:
;
;
System
instead of writing a function then scheduling in your plugin's build function:
you can do it via the auto_system(..) attribute macro:
Generics
Component
if your items have generics, you can specify the types using the generics(...) meta argument for each concrete type.
;
;
this will generate something equivalent to:
System
if your systems have generics, you can specify the types using the generics(...) meta argument for each concrete type.
this will generate something equivalent to:
Plugin
There are three distinct ways to make a bindable plugin:
;
;
;
There is auto_plugin arguments if your plugin has generics.
See tests for other examples
Expanded
If you were looking to cherry-pick certain functionality like auto_name or auto_register_type for example you could use them individually:
Only requirement is you need to make sure you are binding to a plugin that derives AutoPlugin
Usage Examples
use *;
use *;
;
;
// or if you want to omit plugin for each auto_* item:
;
;
;
;
Which automatically implements the Plugin trait for MyPlugin and registers all the types, resources, events, and systems when the plugin is added to the app.
Known Limitations
- WASM should work, CI uses the
wasm-bindgen-test-runnerbut maybe there's a specific wasm target/environment where it fails?
Changelog
Migrations
License
All code in this repository is dual-licensed under either:
-
MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
-
Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
at your option. This means you can select the license you prefer.
Your Contributions
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual-licensed as above, without any additional terms or conditions.