Fix archetypes_generation being incorrectly updated for systems (#294) (#383)

This commit is contained in:
Boxy 2020-08-30 02:38:05 +01:00 committed by GitHub
parent 8101622f37
commit 3efbaca104
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -282,6 +282,7 @@ impl ExecutorStage {
systems: &[Arc<Mutex<Box<dyn System>>>], systems: &[Arc<Mutex<Box<dyn System>>>],
schedule_changed: bool, schedule_changed: bool,
) { ) {
let start_archetypes_generation = world.archetypes_generation();
let compute_pool = resources let compute_pool = resources
.get_cloned::<bevy_tasks::ComputeTaskPool>() .get_cloned::<bevy_tasks::ComputeTaskPool>()
.unwrap(); .unwrap();
@ -388,9 +389,13 @@ impl ExecutorStage {
} }
} }
// If world's archetypes_generation is the same as it was before running any systems then
// we can assume that all systems have correct archetype accesses.
if start_archetypes_generation == world.archetypes_generation() {
self.last_archetypes_generation = world.archetypes_generation(); self.last_archetypes_generation = world.archetypes_generation();
} }
} }
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {