mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 20:53:53 +00:00
0174d632a5
# Objective If you want to execute a schedule on the world using arbitrarily complex behavior, you currently need to use "hokey-pokey strats": remove the schedule from the world, do your thing, and add it back to the world. Not only is this cumbersome, it's potentially error-prone as one might forget to re-insert the schedule. ## Solution Add the `World::{try}schedule_scope{ref}` family of functions, which is a convenient abstraction over hokey pokey strats. This method essentially works the same way as `World::resource_scope`. ### Example ```rust // Run the schedule five times. world.schedule_scope(MySchedule, |world, schedule| { for _ in 0..5 { schedule.run(world); } }); ``` --- ## Changelog Added the `World::schedule_scope` family of methods, which provide a way to get mutable access to a world and one of its schedules at the same time. --------- Co-authored-by: James Liu <contact@jamessliu.com> |
||
---|---|---|
.. | ||
src | ||
Cargo.toml |