bevy_fallable

Crates.iobevy_fallable
lib.rsbevy_fallable
version0.3.0
sourcesrc
created_at2020-11-28 18:31:54.054626
updated_at2020-11-28 18:31:54.054626
descriptionA simple plugin to add fallable systems to Bevy game engine
homepage
repositoryhttps://github.com/barsoosayque/bevy_fallable
max_upload_size
id317533
size5,095
(barsoosayque)

documentation

README

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();
}
Commit count: 12

cargo fmt