diff --git a/crates/bevy_reflect/src/impls/bevy_ecs.rs b/crates/bevy_reflect/src/impls/bevy_ecs.rs index abe1170609..4be4a77bac 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(())