Skip to content

Commit

Permalink
Add rename to changelog and make it non-breaking
Browse files Browse the repository at this point in the history
  • Loading branch information
NiklasEi committed Dec 30, 2024
1 parent 8eb72eb commit 03937db
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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))
Expand Down
4 changes: 4 additions & 0 deletions bevy_asset_loader/src/loading_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,10 @@ impl<S: FreelyMutableState> ConfigureLoadingState for LoadingState<S> {

self
}

fn init_resource<R: Resource + FromWorld>(self) -> Self {
self.finally_init_resource::<R>()
}
}

/// Systems in this set check the loading state of assets.
Expand Down
15 changes: 15 additions & 0 deletions bevy_asset_loader/src/loading_state/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<C: DynamicAssetCollection + Asset>(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<R: Resource + FromWorld>(self) -> Self;
}

/// Can be used to add new asset collections or similar configuration to a loading state.
Expand Down Expand Up @@ -192,4 +203,8 @@ impl<S: FreelyMutableState> ConfigureLoadingState for LoadingStateConfig<S> {

self
}

fn init_resource<R: Resource + FromWorld>(self) -> Self {
self.finally_init_resource::<R>()
}
}

0 comments on commit 03937db

Please sign in to comment.