I am toying with an API change in bevy_asset_loader and am hoping for some criticism/bike shedding.
The current API has separate extension methods on Bevy's App to add a loading state and to configure it with, for example, collections. The configuration extension methods require some ugly generics and all take the state.
The new API only has two methods on App: add_loading_state and configure_loading_state. Both allow to add any number of asset collections and other configuration.
This is the diff for adding some collections and a dynamic asset file directly to a loading state:
.add_loading_state(
- LoadingState::new(MyStates::AssetLoading).continue_to_state(MyStates::Next),
+ LoadingState::new(MyStates::AssetLoading)
+ .continue_to_state(MyStates::Next)
+ .with_dynamic_assets_file::<StandardDynamicAssetCollection>(
+ "dynamic_asset.assets.ron",
+ )
+ .load_collection::<ImageAssets>()
+ .load_collection::<AudioAssets>(),
)
- .add_dynamic_collection_to_loading_state::<_, StandardDynamicAssetCollection>(
- MyStates::AssetLoading,
- "dynamic_asset.assets.ron",
- )
- .add_collection_to_loading_state::<_, ImageAssets>(MyStates::AssetLoading)
- .add_collection_to_loading_state::<_, AudioAssets>(MyStates::AssetLoading)
Any opinions on the changes? Anything you ever wanted changed about the API of bevy_asset_loader?
The full WIP changes can be seen in a draft PR.