Add configure_schedules to App and Schedules to apply ScheduleBuildSettings to all schedules#9514
Conversation
ScheduleBuildSettings to all schedulesScheduleBuildSettings to all schedules
|
Thanks! |
hymm
left a comment
There was a problem hiding this comment.
I worry a little that there isn't a way to turn on say ambiguity detection for all schedules, but leave the rest of the settings untouched. But I think the predominant usage will be to just set all the schedules the same anyways, so going to approve and see what happens.
|
That can still be done manually, using the workaround in the linked issue plus struct update syntax :) If that turns out to be a common pattern in practice though we can add a new method. |
|
There's no getter for the current build settings, so you can't use the struct update syntax. |
|
|
||
| /// Returns the schedule's current `ScheduleBuildSettings`. | ||
| pub fn get_build_settings(&self) -> ScheduleBuildSettings { | ||
| self.graph.settings.clone() |
There was a problem hiding this comment.
Clone because it's a light struct and we're not mutating the return value.
|
Makes sense to add the ability to chain App::new()
// ...
.configure_schedules(ScheduleBuildSettings {
ambiguity_detection: LogLevel::Error,
..schedule.get_build_settings()
})
// ...
.run() |
…ettings` to all schedules (bevyengine#9514) # Objective - Fixes: bevyengine#9508 - Fixes: bevyengine#9526 ## Solution - Adds ```rust fn configure_schedules(&mut self, schedule_build_settings: ScheduleBuildSettings) ``` to `Schedules`, and `App` to simplify applying `ScheduleBuildSettings` to all schedules. --- ## Migration Guide - No breaking changes. - Adds `Schedule::get_build_settings()` getter for the schedule's `ScheduleBuildSettings`. - Can replaced manual configuration of all schedules: ```rust // Old for (_, schedule) in app.world.resource_mut::<Schedules>().iter_mut() { schedule.set_build_settings(build_settings); } // New app.configure_schedules(build_settings); ```
Objective
AppandSchedulesto configure all schedules #9508Solution
to
Schedules, andAppto simplify applyingScheduleBuildSettingsto all schedules.Migration Guide
Schedule::get_build_settings()getter for the schedule'sScheduleBuildSettings.