Skip to content

Commit

Permalink
Actually register the new OnTransition schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsDoot committed Mar 7, 2023
1 parent 4fb0392 commit 99788a5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 10 additions & 1 deletion crates/bevy_app/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,16 @@ impl App {
// These are different for loops to avoid conflicting access to self
for variant in S::variants() {
self.add_schedule(OnEnter(variant.clone()), Schedule::new());
self.add_schedule(OnExit(variant), Schedule::new());
self.add_schedule(OnExit(variant.clone()), Schedule::new());

for second in S::variants() {
if second == variant {
// skip adding OnTransition for A -> A
continue;
}

self.add_schedule(OnTransition(variant.clone(), second), Schedule::new());
}
}

self
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_ecs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ pub mod prelude {
schedule::{
apply_state_transition, apply_system_buffers, common_conditions::*, Condition,
IntoSystemConfig, IntoSystemConfigs, IntoSystemSet, IntoSystemSetConfig,
IntoSystemSetConfigs, NextState, OnEnter, OnExit, OnUpdate, Schedule, Schedules, State,
States, SystemSet,
IntoSystemSetConfigs, NextState, OnEnter, OnExit, OnTransition, OnUpdate, Schedule,
Schedules, State, States, SystemSet,
},
system::{
adapter as system_adapter,
Expand Down

0 comments on commit 99788a5

Please sign in to comment.