diff --git a/crates/bevy_app/src/app.rs b/crates/bevy_app/src/app.rs index 37f27e6a385bd..ecf9245591995 100644 --- a/crates/bevy_app/src/app.rs +++ b/crates/bevy_app/src/app.rs @@ -321,7 +321,7 @@ impl App { /// These systems sets only run if the [`State`] resource matches their label. /// /// If you would like to control how other systems run based on the current state, - /// you can emulate this behavior using the [`state_equals`] [`Condition`](bevy_ecs::schedule::Condition). + /// you can emulate this behavior using the [`in_state`] [`Condition`](bevy_ecs::schedule::Condition). /// /// Note that you can also apply state transitions at other points in the schedule /// by adding the [`apply_state_transition`] system manually. @@ -342,7 +342,7 @@ impl App { main_schedule.configure_set( OnUpdate(variant.clone()) .in_base_set(CoreSet::Update) - .run_if(state_equals(variant)) + .run_if(in_state(variant)) .after(apply_state_transition::), ); } diff --git a/crates/bevy_ecs/src/schedule/condition.rs b/crates/bevy_ecs/src/schedule/condition.rs index 763d88d8e0901..957eb806d150c 100644 --- a/crates/bevy_ecs/src/schedule/condition.rs +++ b/crates/bevy_ecs/src/schedule/condition.rs @@ -92,7 +92,7 @@ pub mod common_conditions { /// # Panics /// /// The condition will panic if the resource does not exist. - pub fn state_equals(state: S) -> impl FnMut(Res>) -> bool { + pub fn in_state(state: S) -> impl FnMut(Res>) -> bool { move |current_state: Res>| current_state.0 == state } diff --git a/crates/bevy_ecs/src/schedule/state.rs b/crates/bevy_ecs/src/schedule/state.rs index 2ae15eb888e85..e2b51cf70e8c1 100644 --- a/crates/bevy_ecs/src/schedule/state.rs +++ b/crates/bevy_ecs/src/schedule/state.rs @@ -56,7 +56,7 @@ pub struct OnExit(pub S); /// A [`SystemSet`] that will run within `CoreSet::Update` when this state is active. /// /// This set, when created via `App::add_state`, is configured with both a base set and a run condition. -/// If all you want is the run condition, use the [`state_equals`](crate::schedule::common_conditions::state_equals) +/// If all you want is the run condition, use the [`in_state`](crate::schedule::common_conditions::in_state) /// [condition](super::Condition) directly. #[derive(SystemSet, Clone, Debug, PartialEq, Eq, Hash)] pub struct OnUpdate(pub S);