pub trait AssetCollection: Resource {
    // Required methods
    fn create(world: &mut World) -> Self;
    fn load(world: &mut World) -> Vec<UntypedHandle>;
}
Expand description

Trait to mark a struct as a collection of assets

Derive is supported for structs with named fields.

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

Required Methods§

source

fn create(world: &mut World) -> Self

Create a new asset collection from the AssetServer

source

fn load(world: &mut World) -> Vec<UntypedHandle>

Start loading all the assets in the collection

Object Safety§

This trait is not object safe.

Implementors§