bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Fix PickingInteraction change detection

Open kristoff3r opened this issue 7 months ago • 0 comments

Objective

Fixes #19464

Solution

Instead of clearing previous PickingInteractions before updating, we clear them last for those components that weren't updated, and use set_if_neq when writing.

Testing

I tried the sprite_picking example and it still works.

You can add the following system to picking examples to check that change detection works as intended:

fn print_picking(query: Query<(Entity, &PickingInteraction), Changed<PickingInteraction>>) {
    for (entity, interaction) in &query {
        println!("{entity} {interaction:?}");
    }
}

kristoff3r avatar Jun 04 '25 14:06 kristoff3r