| Crates.io | bevy_background_compute |
| lib.rs | bevy_background_compute |
| version | 0.8.0 |
| created_at | 2022-09-11 17:50:39.486242+00 |
| updated_at | 2024-12-27 23:59:38.640907+00 |
| description | Bevy plugin for better task handling |
| homepage | |
| repository | https://github.com/Demiu/bevy_background_compute |
| max_upload_size | |
| id | 663154 |
| size | 51,775 |
This bevy plugin provides improvements to handling of background tasks. It adds a Commands extension to more easily place a Future onto bevy's TaskPool and upon completion it will send a callback in the form of an event containing the result.
Check out the basic_usage example with
cargo run --example basic_usage
In order to keep track of running tasks and to produce completion events every type returned by your Futures has to be registered using the BackgroundComputePlugin<T>.
app.add_plugins(BackgroundComputePlugin::<MyType>::default())
commands.compute_in_background(async {
// Your code here
});
// Create a system consuming BackgroundComputeComplete<T> events
fn my_callback_sys(
mut events: EventReader<BackgroundComputeComplete<MyType>>
) {
// Handle like any other bevy event
}
| Plugin | Bevy |
|---|---|
| 0.1 | 0.8 |
| 0.2 | 0.9 |
| 0.3 | 0.10 |
| 0.4 | 0.11 |
| 0.5 | 0.12 |
| 0.6 | 0.13 |
| 0.7 | 0.14 |
| 0.8 | 0.15 |