Add timer-based common run conditions #7864
Labels
A-Time
Involves time keeping and reporting
C-Usability
A targeted quality-of-life change that makes Bevy easier to use
D-Trivial
Nice and easy! A great choice to get started with Bevy
What problem does this solve or what need does it fill?
Users often want to run a system (like logging, polling or factory ticks) on a regular timer. Currently, this involves a fair bit of type-level boilerplate to define a resource type, or clever use of either run conditions or
Local
system variables.What solution would you like?
Create a run condition that stores a
Timer
in itsLocal
, with a convenient method to generate such a run conditions.Ideally this would look like:
There should also be a
on_fixed_timer
variant, which uses elapsedFixedTime
.See the existing common run conditions in
bevy_ecs
andbevy_input
for how to do so.What alternative(s) have you considered?
We could add multiple fixed time steps again (which were previously used for this), but these are not equivalent and this previous pattern was incorrect. See #7637.
Additional context
Credit to @maniwani for the idea: I just made the ticket ;)
The text was updated successfully, but these errors were encountered: