[][src]Crate bevy_discovery

Bevy Discovery

This crate adds #[derive(DiscoveryPlugin)] which will scan the project files for functions annotated with #[system] and register them automagically. Example:

use bevy::prelude::*;
extern crate bevy_discovery;

fn main() {

fn discovered_system() {
    println!("Woo, discovered system!");

fn post_update_system() {
    println!("Hey, post update system!");
struct DiscoveryPlugin;

Compile time performance

Full rebuild Incremental
Normal 198.982 ± 1.167 s 25.944 ± 1.486 s
Discovered 207.636 ± 3.785 s 26.546 ± 1.782 s

These are the compile times for my fork of bevy-robbo, averaged over five runs with a discarded warmup round each using hyperfine.

Attribute Macros


Use this macro to annotate systems that need to be registered. Optionally, you can pass a value that evaluates to &str to register the macro in a specific stage.

Derive Macros


Annotating a struct with this will implement Plugin for it, registering all functions with the #[system] attribute accessible from the root file. By default, the root file is src/main.rs, but this can be overriden using #[root(path/to/root.rs)]