Trait bevy_asset::AddAsset

source ·
pub trait AddAsset {
    // Required methods
    fn add_asset<T>(&mut self) -> &mut Self
       where T: Asset;
    fn register_asset_reflect<T>(&mut self) -> &mut Self
       where T: Asset + Reflect + FromReflect + GetTypeRegistration;
    fn add_debug_asset<T>(&mut self) -> &mut Self
       where T: Asset + Clone;
    fn init_asset_loader<T>(&mut self) -> &mut Self
       where T: AssetLoader + FromWorld;
    fn init_debug_asset_loader<T>(&mut self) -> &mut Self
       where T: AssetLoader + FromWorld;
    fn add_asset_loader<T>(&mut self, loader: T) -> &mut Self
       where T: AssetLoader;
}
Expand description

App extension methods for adding new asset types.

Required Methods§

source

fn add_asset<T>(&mut self) -> &mut Selfwhere T: Asset,

Registers T as a supported asset in the application.

Adding the same type again after it has been added does nothing.

source

fn register_asset_reflect<T>(&mut self) -> &mut Selfwhere T: Asset + Reflect + FromReflect + GetTypeRegistration,

Registers the asset type T using [App::register], and adds ReflectAsset type data to T and ReflectHandle type data to Handle<T> in the type registry.

This enables reflection code to access assets. For detailed information, see the docs on ReflectAsset and ReflectHandle.

source

fn add_debug_asset<T>(&mut self) -> &mut Selfwhere T: Asset + Clone,

Registers T as a supported internal asset in the application.

Internal assets (e.g. shaders) are bundled directly into the app and can’t be hot reloaded using the conventional API. See DebugAssetServerPlugin.

Adding the same type again after it has been added does nothing.

source

fn init_asset_loader<T>(&mut self) -> &mut Selfwhere T: AssetLoader + FromWorld,

Adds an asset loader T using default values.

The default values may come from the World or from T::default().

source

fn init_debug_asset_loader<T>(&mut self) -> &mut Selfwhere T: AssetLoader + FromWorld,

Adds an asset loader T for internal assets using default values.

Internal assets (e.g. shaders) are bundled directly into the app and can’t be hot reloaded using the conventional API. See DebugAssetServerPlugin.

The default values may come from the World or from T::default().

source

fn add_asset_loader<T>(&mut self, loader: T) -> &mut Selfwhere T: AssetLoader,

Adds the provided asset loader to the application.

Implementations on Foreign Types§

source§

impl AddAsset for App

source§

fn add_asset<T>(&mut self) -> &mut Selfwhere T: Asset,

source§

fn register_asset_reflect<T>(&mut self) -> &mut Selfwhere T: Asset + Reflect + FromReflect + GetTypeRegistration,

source§

fn add_debug_asset<T>(&mut self) -> &mut Selfwhere T: Asset + Clone,

source§

fn init_asset_loader<T>(&mut self) -> &mut Selfwhere T: AssetLoader + FromWorld,

source§

fn init_debug_asset_loader<T>(&mut self) -> &mut Selfwhere T: AssetLoader + FromWorld,

source§

fn add_asset_loader<T>(&mut self, loader: T) -> &mut Selfwhere T: AssetLoader,

Implementors§