You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a split method to ResMut<Events<T>>, which returns two iterators of events based on whether the supplied predicate is true. This doesn't make the chaos any better, but does improve ergonomics.
However this is not a particularly principle or discoverable approach, and risks serious chaos as input events are silently eaten according to decentralized rules based on system ordering.
Additional context
Initially discussed on Discord. Led to #3569. Related reddit post with proposed workarounds.
What problem does this solve or what need does it fill?
Typically, when users click on a UI element (including in game units), we don't want to also handle that click in the rest of the world.
The same pattern is observed when typing into a chat box, where the keyboard inputs are stolen.
Right now, the default behavior is to pass all events through.
What solution would you like?
A few solutions immediately come to mind:
splitmethod toResMut<Events<T>>, which returns two iterators of events based on whether the supplied predicate is true. This doesn't make the chaos any better, but does improve ergonomics.What alternative(s) have you considered?
Consume events in one-off systems using
ResMut<Events<Input<T>>>.This was the approach taken in vladbat00/bevy_egui#50, specifically vladbat00/bevy_egui@53c1773#diff-420f4e08a25299e0e1fb09f4757e1d5d027a2278f37030c09ab9c06786cfa52eR283.
However this is not a particularly principle or discoverable approach, and risks serious chaos as input events are silently eaten according to decentralized rules based on system ordering.
Additional context
Initially discussed on Discord. Led to #3569. Related reddit post with proposed workarounds.