Trait bevy_asset_loader::AssetCollection[][src]

pub trait AssetCollection: Component {
    fn create(asset_server: &Res<'_, AssetServer>) -> Self;
fn load(asset_server: &Res<'_, AssetServer>) -> Vec<HandleUntyped>; }
Expand description

Trait to mark a struct as a collection of assets

Derive is supported for structs with named fields. Each field needs to be annotated with #[asset(path = "path/to/asset.file")]

#[derive(AssetCollection)]
struct MyAssets {
    #[asset(path = "player.png")]
    player: Handle<Texture>,
    #[asset(path = "tree.png")]
    tree: Handle<Texture>
}

Required methods

Create a new AssetCollection from the [bevy::asset::AssetServer]

Start loading all the assets in the collection

Implementors