mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 15:14:50 +00:00
f7f7e326e5
# Objective `FromWorld` is often used to group loading and creation of assets for resources. With this setup, users often end up repetitively calling `.resource::<AssetServer>` and `.resource_mut::<Assets<T>>`, and may have difficulties handling lifetimes of the returned references. ## Solution Add extension methods to `World` to add and load assets, through a new extension trait defined in `bevy_asset`. ### Other considerations * This might be a bit too "magic", as it makes implicit the resource access. * We could also implement `DirectAssetAccessExt` on `App`, but it didn't feel necessary, as `FromWorld` is the principal use-case here. --- ## Changelog * Add the `DirectAssetAccessExt` trait, which adds the `add_asset`, `load_asset` and `load_asset_with_settings` method to the `World` type. |
||
---|---|---|
.. | ||
macros | ||
src | ||
Cargo.toml |