aevyrie / bevy_mod_picking

Picking and pointer events for Bevy.
https://crates.io/crates/bevy_mod_picking
Apache License 2.0
791 stars 174 forks source link

Non-determenistic behavior in picking and selection #274

Closed ennwise closed 11 months ago

ennwise commented 1 year ago

I was following a youtube example showing bevy 0.8/0.9 which goes through the features in a small tower defense demo.

In the latest version of bevy with bevy_mod_picking I've come across an issue where if I have an item selected in the world, and then using the picking system to show a pickinginteraction of pressed on a UI button, if I when that button is pressed check the selection back in the world items, I will find that some executions this behavior works as expected and I see that the world item is still selected. Other executions the menu disappears and no selected item was registered.

https://git.ennwise.com/jennen/rpg/-/tree/c20e8f4fa7ebc33df164dc157230d57314ac701b is the repo https://git.ennwise.com/jennen/rpg/-/blob/c20e8f4fa7ebc33df164dc157230d57314ac701b/src/ui.rs has the relevant sections being referred to

I'm not sure if this is expected behavior and I am missing proper setup/procedures on how these systems are supposed to be used.

ennwise commented 1 year ago

It would seem the fact that it worked at all was indeed a bug, and that https://github.com/aevyrie/bevy_mod_picking/pull/266 addresses this. I haven't used the latest commits but have found that putting NoDeselect on the buttons does result in a working build.

aevyrie commented 11 months ago

Yes, this was a bug that should now be resolved. Please reopen if you find another case, this is not intended behavior, Thank you for the report!