From 834411c05a136426e7ce789ed67e05506859cef9 Mon Sep 17 00:00:00 2001 From: Ellen Date: Sat, 29 Aug 2020 20:43:52 +0100 Subject: [PATCH] Fix archetypes_generation being incorrectly updated for systems (#294) --- crates/bevy_ecs/src/schedule/parallel_executor.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/bevy_ecs/src/schedule/parallel_executor.rs b/crates/bevy_ecs/src/schedule/parallel_executor.rs index 3b434db503b6f..8d7c29a79c587 100644 --- a/crates/bevy_ecs/src/schedule/parallel_executor.rs +++ b/crates/bevy_ecs/src/schedule/parallel_executor.rs @@ -282,6 +282,7 @@ impl ExecutorStage { systems: &[Arc>>], schedule_changed: bool, ) { + let start_archetypes_generation = world.archetypes_generation(); let compute_pool = resources .get_cloned::() .unwrap(); @@ -388,7 +389,11 @@ impl ExecutorStage { } } - self.last_archetypes_generation = world.archetypes_generation(); + // 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(); + } } }