Crates.io | bevy_fallable |
lib.rs | bevy_fallable |
version | 0.3.0 |
source | src |
created_at | 2020-11-28 18:31:54.054626 |
updated_at | 2020-11-28 18:31:54.054626 |
description | A simple plugin to add fallable systems to Bevy game engine |
homepage | |
repository | https://github.com/barsoosayque/bevy_fallable |
max_upload_size | |
id | 317533 |
size | 5,095 |
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();
}