Only clear source handles if PannerStrategy is actually changed (I.e. mutated, not added.)

This commit is contained in:
Nolan Darilek 2022-09-05 12:24:06 -05:00
parent 72c63af910
commit ba45547038

View File

@ -332,13 +332,15 @@ fn swap_buffers(
} }
fn change_panner_strategy( fn change_panner_strategy(
changed: Query<Entity, Changed<PannerStrategy>>, changed: Query<(Entity, ChangeTrackers<PannerStrategy>)>,
removed: RemovedComponents<PannerStrategy>, removed: RemovedComponents<PannerStrategy>,
mut sources: Query<&mut Source>, mut sources: Query<&mut Source>,
) { ) {
let mut check = vec![]; let mut check = vec![];
for entity in &changed { for (entity, change) in &changed {
check.push(entity); if !change.is_added() && change.is_changed() {
check.push(entity);
}
} }
for entity in removed.iter() { for entity in removed.iter() {
check.push(entity); check.push(entity);