Trait bevy_asset::Asset
source · pub trait Asset: TypeUuid + TypePath + AssetDynamic { }
Expand description
An essential piece of data of an application.
Assets are the building blocks of games. They can be anything, from images and sounds to scenes and scripts. In Bevy, an asset is any struct that has an unique type id, as shown below:
use bevy_reflect::{TypePath, TypeUuid};
use serde::Deserialize;
#[derive(Debug, Deserialize, TypeUuid, TypePath)]
#[uuid = "39cadc56-aa9c-4543-8640-a018b74b5052"]
pub struct CustomAsset {
pub value: i32,
}
See the assets/custom_asset.rs
example in the repository for more details.
In order to load assets into your game you must either add them manually to an asset storage
with Assets::add
or load them from the filesystem with AssetServer::load
.
Object Safety§
This trait is not object safe.