bevy
bevy copied to clipboard
Panic-less version of World::run_schedule
What problem does this solve or what need does it fill?
As of #7911, Bevy no longer panics when a system is added to a schedule that doesn't exist yet. However, that's only for adding systems, not running them.
What solution would you like?
A version of World::run_schedule
that returns a Result rather than panic, likely called World::try_run_schedule
.
What alternative(s) have you considered?
Check the Schedules
resource for an existing schedule before running it.
Additional Context
Ran into this issue during #7936.
Remember to check and replace internal usages too after adding this method :)
Relevant: https://github.com/bevyengine/bevy/pull/8079#discussion_r1140786056
If we're going to embrace this pattern we really need to remove the warnings here. I'm removing them in that PR.