Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/bevy_app/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,9 @@ impl App {
/// initial state.
///
/// This also adds an [`OnUpdate`] system set for each state variant,
/// which run during [`CoreSet::StateTransitions`] after the transitions are applied.
/// which is configured to run after [`apply_state_transition::<S>`].
/// These systems sets only run if the [`State<S>`] resource matches their label.
/// Like usual, if no base set is configured, these will run in [`CoreSet::Update`].
///
/// 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).
Expand All @@ -341,7 +342,6 @@ impl App {
for variant in S::variants() {
main_schedule.configure_set(
OnUpdate(variant.clone())
.in_base_set(CoreSet::StateTransitions)
.run_if(state_equals(variant))
.after(apply_state_transition::<S>),
);
Expand Down
4 changes: 3 additions & 1 deletion crates/bevy_ecs/src/schedule/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ pub struct OnEnter<S: States>(pub S);
#[derive(ScheduleLabel, Clone, Debug, PartialEq, Eq, Hash)]
pub struct OnExit<S: States>(pub S);

/// A [`SystemSet`] that will run within `CoreSet::StateTransitions` when this state is active.
/// A [`SystemSet`] that will run when this state is active.
/// It should always run after [`apply_state_transition::<S>`],
/// and is configured to do so by default.
///
/// This is provided for convenience. A more general [`state_equals`](crate::schedule::common_conditions::state_equals)
/// [condition](super::Condition) also exists for systems that need to run elsewhere.
Expand Down