Skip to content

Commit c26a45e

Browse files
Add StateScoped as deprecated type alias (#21070)
# Objective - Make migration easier. - Fixes #21035. ## Solution - Add a deprecated type alias to help with the rename, rather than immediately renaming. - Remember to re-export it in the prelude too to reduce compiler errors.
1 parent beb42ae commit c26a45e

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

crates/bevy_state/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,13 @@ pub mod prelude {
8282
#[doc(hidden)]
8383
pub use crate::reflect::{ReflectFreelyMutableState, ReflectState};
8484

85+
#[doc(hidden)]
86+
#[expect(
87+
deprecated,
88+
reason = "Temporarily re-exporting deprecated type for transition"
89+
)]
90+
pub use crate::state_scoped::StateScoped;
91+
8592
#[doc(hidden)]
8693
pub use crate::{
8794
commands::CommandsStatesExt,

crates/bevy_state/src/state_scoped.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ where
6363
}
6464
}
6565

66+
/// A deprecated alias for [`DespawnOnExit`].
67+
#[deprecated(since = "0.17.0", note = "use DespawnOnExit instead")]
68+
pub type StateScoped<S> = DespawnOnExit<S>;
69+
6670
/// Despawns entities marked with [`DespawnOnExit<S>`] when their state no
6771
/// longer matches the world state.
6872
pub fn despawn_entities_on_exit_state<S: States>(

0 commit comments

Comments
 (0)