pub trait Asset: Send + Sync + 'static {
    type Data: Send + Sync + 'static;
    type HandleStorage: UnprotectedStorage<Handle<Self>> + Send + Sync;

    const NAME: &'static str;
}
Expand description

One of the three core traits of this crate.

You want to implement this for every type of asset like

  • Mesh
  • Texture
  • Terrain

and so on. Now, an asset may be available in different formats. That’s why we have the Data associated type here. You can specify an intermediate format here, like the vertex data for a mesh or the samples for audio data.

This data is then generated by the Format trait.

Required Associated Types

The Data type the asset can be created from.

The ECS storage type to be used. You’ll want to use VecStorage in most cases.

Required Associated Constants

An identifier for this asset used for debugging.

Implementors