-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add configure_schedules to App and Schedules to apply ScheduleBuildSettings
to all schedules
#9514
Add configure_schedules to App and Schedules to apply ScheduleBuildSettings
to all schedules
#9514
Conversation
ScheduleBuildSettings
to all schedulesScheduleBuildSettings
to all schedules
Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
@@ -198,6 +205,11 @@ impl Schedule { | |||
self | |||
} | |||
|
|||
/// Returns the schedule's current `ScheduleBuildSettings`. | |||
pub fn get_build_settings(&self) -> ScheduleBuildSettings { | |||
self.graph.settings.clone() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
App
andSchedules
to configure all schedules #9508Solution
to
Schedules
, andApp
to simplify applyingScheduleBuildSettings
to all schedules.Migration Guide
Schedule::get_build_settings()
getter for the schedule'sScheduleBuildSettings
.