Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not add OnUpdate system set to CoreSet::ApplyStateTransitions #7634

Closed
wants to merge 1 commit into from
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