diff --git a/crates/bevy_ecs/src/system/commands.rs b/crates/bevy_ecs/src/system/commands.rs index 4daf76d3d890ec..e36de7ef78b5a4 100644 --- a/crates/bevy_ecs/src/system/commands.rs +++ b/crates/bevy_ecs/src/system/commands.rs @@ -126,13 +126,23 @@ where T: Bundle + Send + Sync + 'static, { fn write(self: Box, world: &mut World, _resources: &mut Resources) { - if let Err(e) = world.remove::(self.entity) { - log::warn!( - "Failed to remove components {:?} with error: {}. Falling back to inefficient one-by-one component removing.", - std::any::type_name::(), - e - ); - if let Err(e) = world.remove_one_by_one::(self.entity) { + match world.remove::(self.entity) { + Ok(_) => (), + Err(bevy_hecs::ComponentError::MissingComponent(e)) => { + log::warn!( + "Failed to remove components {:?} with error: {}. Falling back to inefficient one-by-one component removing.", + std::any::type_name::(), + e + ); + if let Err(e) = world.remove_one_by_one::(self.entity) { + log::debug!( + "Failed to remove components {:?} with error: {}", + std::any::type_name::(), + e + ); + } + } + Err(e) => { log::debug!( "Failed to remove components {:?} with error: {}", std::any::type_name::(),