Add an additional constructor method to ManualEventReader
, which starts at the current frame's events
#6589
Labels
A-ECS
Entities, components, systems, and events
C-Usability
A targeted quality-of-life change that makes Bevy easier to use
What problem does this solve or what need does it fill?
#5730 introduced a generally helpful error message,
However, when working with
ManualEventReader
to read recent events viaEvents:;get_reader
, this error is triggered constantly.What solution would you like?
The correct solution here, is to instead initialize the manual event reader at the start of the events that occured this frame. This avoids double-reading, and silences the warning.
In order to do this however,
bevy_ecs
needs to expose a constructor alaget_current
that sets the internalevents_seen
field correctly.What alternative(s) have you considered?
We could instead (or additionally) allow public construction of
EventReader
fromEvents
, but this feels more likely to be confused and misused.Adding public access to
ManualEventReader
ofEventReader
may work to solve my particular issue as well, albeit in a bit messier of a way.The text was updated successfully, but these errors were encountered: