Skip to content
Merged
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
21 changes: 20 additions & 1 deletion crates/bevy_ecs/src/schedule/executor/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ use fixedbitset::FixedBitSet;
use std::panic::AssertUnwindSafe;

use crate::{
schedule::{BoxedCondition, ExecutorKind, SystemExecutor, SystemSchedule},
schedule::{
executor::is_apply_deferred, BoxedCondition, ExecutorKind, SystemExecutor, SystemSchedule,
},
world::World,
};

Expand Down Expand Up @@ -86,6 +88,10 @@ impl SystemExecutor for SimpleExecutor {
}

let system = &mut schedule.systems[system_index];
if is_apply_deferred(system) {
continue;
}

let res = std::panic::catch_unwind(AssertUnwindSafe(|| {
system.run((), world);
}));
Expand Down Expand Up @@ -125,3 +131,16 @@ fn evaluate_and_fold_conditions(conditions: &mut [BoxedCondition], world: &mut W
.map(|condition| condition.run((), world))
.fold(true, |acc, res| acc && res)
}

#[cfg(test)]
#[test]
fn skip_automatic_sync_points() {
// Schedules automatically insert appy_deferred systems, but these should
// not be executed as they only serve as markers and are not initialized
use crate::prelude::*;
let mut sched = Schedule::default();
sched.set_executor_kind(ExecutorKind::Simple);
sched.add_systems((|_: Commands| (), || ()).chain());
let mut world = World::new();
sched.run(&mut world);
}