Skip to content

Commit

Permalink
feature gate
Browse files Browse the repository at this point in the history
  • Loading branch information
MiniaczQ committed Jun 3, 2024
1 parent 4ad8ad2 commit bda68df
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions crates/bevy_state/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ use bevy_ecs::{
world::FromWorld,
};

use crate::{
state::{
setup_state_transitions_in_world, ComputedStates, FreelyMutableState, NextState, State,
StateTransition, StateTransitionEvent, StateTransitionSteps, States, SubStates,
},
state_bound::clear_state_bound_entities,
use crate::state::{
setup_state_transitions_in_world, ComputedStates, FreelyMutableState, NextState, State,
StateTransition, StateTransitionEvent, StateTransitionSteps, States, SubStates,
};
#[cfg(feature = "bevy_hierarchy")]
use crate::state_bound::clear_state_bound_entities;

/// State installation methods for [`App`](bevy_app::App) and [`SubApp`](bevy_app::SubApp).
pub trait AppExtStates {
Expand Down Expand Up @@ -52,6 +51,7 @@ pub trait AppExtStates {
/// This method is idempotent: it has no effect when called again using the same generic type.
fn add_sub_state<S: SubStates>(&mut self) -> &mut Self;

#[cfg(feature = "bevy_hierarchy")]
/// Register state bound entity clearing for state `S`.
///
/// For more information refer to [`StateBound`](crate::state_bound::StateBound).
Expand Down Expand Up @@ -133,6 +133,7 @@ impl AppExtStates for SubApp {
self
}

#[cfg(feature = "bevy_hierarchy")]
fn add_state_bound<S: States>(&mut self) -> &mut Self {
self.add_systems(
StateTransition,
Expand Down Expand Up @@ -162,6 +163,7 @@ impl AppExtStates for App {
self
}

#[cfg(feature = "bevy_hierarchy")]
fn add_state_bound<S: States>(&mut self) -> &mut Self {
self.main_mut().add_state_bound::<S>();
self
Expand Down

0 comments on commit bda68df

Please sign in to comment.