bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Add `Commands::run_schedule`

Open maniwani opened this issue 1 year ago • 3 comments

Systems (especially observers) should be able to queue the execution of schedules (which are essentially a special kind of exclusive system). It's currently possible to queue the execution of a system through Commands::run_system, but there's no equivalent Commands::run_schedule counterpart for World::run_schedule.

Off the top of my head, I can't think of any technical blockers.

maniwani avatar Nov 24 '24 20:11 maniwani

Yeah, this should be trivial to implement. The schedule might fail to run if we're inside the same schedule, but that's normal for World::run_schedule.

alice-i-cecile avatar Nov 24 '24 21:11 alice-i-cecile

Currently you can do (pseudocode) commands.queue(|world| world.run_schedule(...)), but I agree this would make sense as a built-in method.

benfrankel avatar Nov 24 '24 22:11 benfrankel

commands.queue(|world| world.run_schedule(...))

We could make this a lint in bevy_cli to suggest simplifying the invocation.

BenjaminBrienen avatar Nov 26 '24 00:11 BenjaminBrienen