Trait bevy::prelude::AddAsset

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: Clone + Asset;
    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§

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.

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.

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

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.

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().

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().

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

Adds the provided asset loader to the application.

Implementors§

§

impl AddAsset for App