Trait bevy::asset::AddAsset

pub trait AddAsset {
    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§

Registers T as a supported asset in the application.

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

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.

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.

Adds an asset loader T using default values.

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

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

Adds the provided asset loader to the application.

Implementors§