bevy/examples/asset
Mincong Lu 1d950e6195
Allow AssetServer::load to acquire a guard item. (#13051)
# Objective

Supercedes #12881 . Added a simple implementation that allows the user
to react to multiple asset loads both synchronously and asynchronously.

## Solution

Added `load_acquire`, that holds an item and drops it when loading is
finished or failed.

When used synchronously 

Hold an `Arc<()>`, check for `Arc::strong_count() == 1` when all loading
completed.

When used asynchronously 

Hold a `SemaphoreGuard`, await on `acquire_all` for completion.

This implementation has more freedom than the original in my opinion.

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: Zachary Harrold <zac@harrold.com.au>
2024-05-23 13:28:29 +00:00
..
files Add example for using .meta files (#12882) 2024-04-08 17:10:56 +00:00
processing Make LoadContext use the builder pattern for loading dependent assets (#13465) 2024-05-22 23:35:41 +00:00
asset_decompression.rs Make LoadContext use the builder pattern for loading dependent assets (#13465) 2024-05-22 23:35:41 +00:00
asset_loading.rs Migrate from LegacyColor to bevy_color::Color (#12163) 2024-02-29 19:35:12 +00:00
asset_settings.rs Fix unfinished sentence in a comment in asset_settings example (#13243) 2024-05-05 14:13:27 +00:00
custom_asset.rs Fix some doc warnings (#12961) 2024-04-14 15:23:44 +00:00
custom_asset_reader.rs Use async-fn in traits rather than BoxedFuture (#12550) 2024-03-18 17:56:57 +00:00
embedded_asset.rs Add extra_asset_source example (#11824) 2024-03-06 16:00:03 +00:00
extra_source.rs Use .register_asset_source() in extra_asset_source example (#12350) 2024-03-07 05:44:52 +00:00
hot_asset_reloading.rs Change light defaults & fix light examples (#11581) 2024-02-14 20:43:10 +00:00
multi_asset_sync.rs Allow AssetServer::load to acquire a guard item. (#13051) 2024-05-23 13:28:29 +00:00
repeated_texture.rs Example with repeated texture (#13176) 2024-05-05 17:29:26 +00:00