only update components for entities in map (#1023)

This commit is contained in:
François 2020-12-09 05:01:54 +01:00 committed by GitHub
parent 19c4f331ac
commit c54179b182
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -202,8 +202,10 @@ impl<C: Component + MapEntities> FromType<C> 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::<C>(entity) {
component.map_entities(entity_map)?;
}
}
Ok(())