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§
sourcefn add_loading_state<S: States>(
&mut self,
loading_state: LoadingState<S>
) -> &mut Self
fn add_loading_state<S: States>( &mut self, loading_state: LoadingState<S> ) -> &mut Self
Add a loading state to your app
sourcefn configure_loading_state<S: States>(
&mut self,
configuration: LoadingStateConfig<S>
) -> &mut Self
fn configure_loading_state<S: States>( &mut self, configuration: LoadingStateConfig<S> ) -> &mut Self
Configure an existing loading state with, for example, additional asset collections.
sourcefn add_collection_to_loading_state<S: States, A: AssetCollection>(
&mut self,
loading_state: S
) -> &mut Self
fn add_collection_to_loading_state<S: States, A: AssetCollection>( &mut self, loading_state: S ) -> &mut Self
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>()
)
sourcefn register_dynamic_asset_collection<S: States, C: DynamicAssetCollection + Asset>(
&mut self,
loading_state: S
) -> &mut Self
fn register_dynamic_asset_collection<S: States, C: DynamicAssetCollection + Asset>( &mut self, loading_state: S ) -> &mut Self
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.
sourcefn add_dynamic_collection_to_loading_state<S: States, C: DynamicAssetCollection + Asset>(
&mut self,
loading_state: S,
file: &str
) -> &mut Self
fn add_dynamic_collection_to_loading_state<S: States, C: DynamicAssetCollection + Asset>( &mut self, loading_state: S, file: &str ) -> &mut Self
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.
Object Safety§
Implementations on Foreign Types§
source§impl LoadingStateAppExt for App
impl LoadingStateAppExt for App
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
source§fn add_collection_to_loading_state<S: States, A: AssetCollection>(
&mut self,
loading_state: S
) -> &mut Self
fn add_collection_to_loading_state<S: States, A: AssetCollection>( &mut self, loading_state: S ) -> &mut Self
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
fn register_dynamic_asset_collection<S: States, C: DynamicAssetCollection + Asset>( &mut self, loading_state: S ) -> &mut Self
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
fn add_dynamic_collection_to_loading_state<S: States, C: DynamicAssetCollection + Asset>( &mut self, loading_state: S, file: &str ) -> &mut Self
LoadingState::with_dynamic_assets_file
or LoadingStateConfig::with_dynamic_assets_file
instead.