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§
sourcefn create(world: &mut World) -> Self
fn create(world: &mut World) -> Self
Create a new asset collection from the AssetServer
sourcefn load(world: &mut World) -> Vec<UntypedHandle>
fn load(world: &mut World) -> Vec<UntypedHandle>
Start loading all the assets in the collection
Object Safety§
This trait is not object safe.