use bevy::prelude::*; /// Despawn all entities with a given component type pub fn despawn_with(mut commands: Commands, q: Query>) { for e in q.iter() { commands.entity(e).despawn_recursive(); } }