#game-engine #bevy #engine #game

yanked bevy_fallable

A simple plugin to add fallable systems to Bevy game engine

0.3.0 Nov 28, 2020

#865 in #game-engine

MIT license

4KB

A simple plugin to install fallable systems to bevy

#[fallable_system]
fn system(asset_server: Res<AssetServer>) -> anyhow::Result<()> {
    let handle: Handle<Texture> = asset_server.load("texture")?;
}

#[derive(Default)]
struct ReportSystemState{ reader: EventReader<SystemErrorEvent> }
fn report_system(mut state: Local<ReportSystemState>, mut events: ResMut<Events<SystemErrorEvent>>) {
    for event in state.reader.iter(&mut events) {
        println!("Error in {}: {}", event.system_name, event.error); 
    }
}

fn main() {
    App::build()
        .add_plugin(FallableSystemPlugin)
        .add_startup_system(system.system())
        .add_system(report_system.system())
        .run();
}

Dependencies

~6–9MB
~154K SLoC