bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
36.46k stars 3.6k forks source link

Add `Commands::run_schedule` #16495

Open maniwani opened 4 days ago

maniwani commented 4 days ago

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.

alice-i-cecile commented 4 days ago

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.

benfrankel commented 4 days ago

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

BenjaminBrienen commented 3 days ago

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

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