bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Panic-less version of World::run_schedule

Open ItsDoot opened this issue 1 year ago • 1 comments

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.

ItsDoot avatar Mar 10 '23 09:03 ItsDoot

Remember to check and replace internal usages too after adding this method :)

alice-i-cecile avatar Mar 10 '23 12:03 alice-i-cecile

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.

cart avatar Mar 17 '23 22:03 cart