0.3.0 |
|
---|
#885 in #engine
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
~7–9.5MB
~164K SLoC