pub trait LoadingStateAppExt {
    // Required methods
    fn add_loading_state<S: States>(
        &mut self,
        loading_state: LoadingState<S>
    ) -> &mut Self;
    fn configure_loading_state<S: States>(
        &mut self,
        configuration: LoadingStateConfig<S>
    ) -> &mut Self;
    fn add_collection_to_loading_state<S: States, A: AssetCollection>(
        &mut self,
        loading_state: S
    ) -> &mut Self;
    fn register_dynamic_asset_collection<S: States, C: DynamicAssetCollection + Asset>(
        &mut self,
        loading_state: S
    ) -> &mut Self;
    fn add_dynamic_collection_to_loading_state<S: States, C: DynamicAssetCollection + Asset>(
        &mut self,
        loading_state: S,
        file: &str
    ) -> &mut Self;
    fn init_resource_after_loading_state<S: States, A: Resource + FromWorld>(
        &mut self,
        loading_state: S
    ) -> &mut Self;
}
Expand description

Extension trait for Bevy Apps to add loading states idiomatically

Required Methods§

source

fn add_loading_state<S: States>( &mut self, loading_state: LoadingState<S> ) -> &mut Self

Add a loading state to your app

source

fn configure_loading_state<S: States>( &mut self, configuration: LoadingStateConfig<S> ) -> &mut Self

Configure an existing loading state with, for example, additional asset collections.

source

fn add_collection_to_loading_state<S: States, A: AssetCollection>( &mut self, loading_state: S ) -> &mut Self

👎Deprecated since 0.19.0: Use LoadingStateConfig::load_collection or LoadingState::load_collection instead.

Add an AssetCollection to the LoadingState

The added collection will be loaded and inserted into your Bevy app as a resource.

    App::new()
        .add_loading_state(
          LoadingState::new(GameState::Loading)
            .continue_to_state(GameState::Menu)
            .load_collection::<AudioAssets>()
            .load_collection::<ImageAssets>()
        )
source

fn register_dynamic_asset_collection<S: States, C: DynamicAssetCollection + Asset>( &mut self, loading_state: S ) -> &mut Self

👎Deprecated since 0.19.0: Use LoadingStateConfig::register_dynamic_asset_collection or LoadingState::register_dynamic_asset_collection instead.

Register a new DynamicAssetCollection to be handled in the loading state

You do not need to call this for [StandardDynamicAssetCollection], only if you want to use your own dynamic asset collection types.

source

fn add_dynamic_collection_to_loading_state<S: States, C: DynamicAssetCollection + Asset>( &mut self, loading_state: S, file: &str ) -> &mut Self

👎Deprecated since 0.19.0: Use LoadingState::with_dynamic_assets_file or LoadingStateConfig::with_dynamic_assets_file instead.

Register files to be loaded as a certain type of DynamicAssetCollection

During the loading state, the given dynamic asset collections will be loaded and their content registered. This will happen before trying to resolve any dynamic assets as part of asset collections.

You need to register a loader for your asset type yourself. If you want to see some code, take a look at the custom_dynamic_assets example.

source

fn init_resource_after_loading_state<S: States, A: Resource + FromWorld>( &mut self, loading_state: S ) -> &mut Self

👎Deprecated since 0.19.0: Use LoadingState::init_resource or LoadingStateConfig::init_resource instead.

Add any FromWorld resource to be initialized after all asset collections are loaded.

    App::new()
        .add_loading_state(
          LoadingState::new(GameState::Loading)
            .continue_to_state(GameState::Menu)
            .load_collection::<TextureForAtlas>()
            .init_resource::<TextureAtlasLayoutFromWorld>()
        )

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl LoadingStateAppExt for App

source§

fn add_loading_state<S: States>( &mut self, loading_state: LoadingState<S> ) -> &mut Self

source§

fn configure_loading_state<S: States>( &mut self, configuration: LoadingStateConfig<S> ) -> &mut Self

source§

fn add_collection_to_loading_state<S: States, A: AssetCollection>( &mut self, loading_state: S ) -> &mut Self

👎Deprecated since 0.19.0: Use LoadingStateConfig::load_collection or LoadingState::load_collection instead.
source§

fn register_dynamic_asset_collection<S: States, C: DynamicAssetCollection + Asset>( &mut self, loading_state: S ) -> &mut Self

👎Deprecated since 0.19.0: Use LoadingStateConfig::register_dynamic_asset_collection or LoadingState::register_dynamic_asset_collection instead.
source§

fn add_dynamic_collection_to_loading_state<S: States, C: DynamicAssetCollection + Asset>( &mut self, loading_state: S, file: &str ) -> &mut Self

👎Deprecated since 0.19.0: Use LoadingState::with_dynamic_assets_file or LoadingStateConfig::with_dynamic_assets_file instead.
source§

fn init_resource_after_loading_state<S: States, A: Resource + FromWorld>( &mut self, loading_state: S ) -> &mut Self

👎Deprecated since 0.19.0: Use LoadingState::init_resource or LoadingStateConfig::init_resource instead.

Implementors§