From 2179c5482069cac011dc7d92b61281020f1ba303 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Mockers?= Date: Mon, 7 Dec 2020 18:29:30 +0100 Subject: [PATCH] only update components for entities in map --- crates/bevy_reflect/src/impls/bevy_ecs.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/bevy_reflect/src/impls/bevy_ecs.rs b/crates/bevy_reflect/src/impls/bevy_ecs.rs index abe11706098d8..4be4a77bacb62 100644 --- a/crates/bevy_reflect/src/impls/bevy_ecs.rs +++ b/crates/bevy_reflect/src/impls/bevy_ecs.rs @@ -202,8 +202,10 @@ impl FromType for ReflectMapEntities { fn from_type() -> Self { ReflectMapEntities { map_entities: |world, entity_map| { - for mut component in &mut world.query_mut::<&mut C>() { - component.map_entities(entity_map)?; + for entity in entity_map.values() { + if let Ok(mut component) = world.get_mut::(entity) { + component.map_entities(entity_map)?; + } } Ok(())