diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e80879..424e03d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog +- renamed `init_resource` to `finally_init_resource` to emphasise the difference to Bevy's `init_resource` + ## v0.22.0 - 01.12.2024 - support for Bevy 0.15 - support for using sub states as loading states ([@mgi388](https://github.com/mgi388) in [#239](https://github.com/NiklasEi/bevy_asset_loader/pull/239)) diff --git a/bevy_asset_loader/src/loading_state.rs b/bevy_asset_loader/src/loading_state.rs index 9653f54..aed9220 100644 --- a/bevy_asset_loader/src/loading_state.rs +++ b/bevy_asset_loader/src/loading_state.rs @@ -477,6 +477,10 @@ impl ConfigureLoadingState for LoadingState { self } + + fn init_resource(self) -> Self { + self.finally_init_resource::() + } } /// Systems in this set check the loading state of assets. diff --git a/bevy_asset_loader/src/loading_state/config.rs b/bevy_asset_loader/src/loading_state/config.rs index 25b2a3f..4be4e8f 100644 --- a/bevy_asset_loader/src/loading_state/config.rs +++ b/bevy_asset_loader/src/loading_state/config.rs @@ -48,6 +48,17 @@ pub trait ConfigureLoadingState { /// See the `dynamic_asset` example #[must_use = "The configuration will only be applied when passed to App::configure_loading_state"] fn with_dynamic_assets_file(self, file: &str) -> Self; + + /// The resource will be initialized at the end of the loading state using its [`FromWorld`] implementation. + /// All asset collections will be available at that point and fully loaded. + /// + /// See the `finally_init_resource` example + #[must_use = "The configuration will only be applied when passed to App::configure_loading_state"] + #[deprecated( + since = "0.22.1", + note = "Method has been renamed to `finally_init_resource`" + )] + fn init_resource(self) -> Self; } /// Can be used to add new asset collections or similar configuration to a loading state. @@ -192,4 +203,8 @@ impl ConfigureLoadingState for LoadingStateConfig { self } + + fn init_resource(self) -> Self { + self.finally_init_resource::() + } }