Skip to content
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 a method on App and Schedules to configure all schedules #9508

Closed
alice-i-cecile opened this issue Aug 20, 2023 · 1 comment · Fixed by #9514
Closed

Add a method on App and Schedules to configure all schedules #9508

alice-i-cecile opened this issue Aug 20, 2023 · 1 comment · Fixed by #9514
Labels
A-App Bevy apps and plugins A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Trivial Nice and easy! A great choice to get started with Bevy

Comments

@alice-i-cecile
Copy link
Member

What problem does this solve or what need does it fill?

Changing ScheduleBuildSettings is currently very onerous: it can only be done one schedule at a time by explicitly naming it.

This is particularly troublesome with system order ambiguities, which must be denied in all schedules for certain applications that require determinism.

What solution would you like?

Add the following method to Schedules.

/// Applies the provided [`ScheduleBuildSettings`] to all schedules.
fn configure_schedules(&mut self, schedule_build_settings: ScheduleBuildSettings)

Then, mirror this method on App, calling the method on Schedules.

What alternative(s) have you considered?

We could provide a universal equivalent to edit_schedule, as seen in the example for this feature. This is more boilerplate in the common case however, and most other uses of schedule modification (like adding systems) aren't well-suited to global application.

Might be worth adding anyways, but as an additional API rather than a replacement.

@alice-i-cecile alice-i-cecile added D-Trivial Nice and easy! A great choice to get started with Bevy A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use A-App Bevy apps and plugins labels Aug 20, 2023
@hymm
Copy link
Contributor

hymm commented Aug 20, 2023

The workaround for this currently is to do:

for (_, schedule) in app.world.resource_mut::<Schedules>().iter_mut() {
    schedule.set_build_settings(ScheduleBuildSettings {
        ambiguity_detection: LogLevel::Error,
        ..Default::default()
    });
}

github-merge-queue bot pushed a commit that referenced this issue Aug 28, 2023
…ettings` to all schedules (#9514)

# Objective

- Fixes: #9508 
- Fixes: #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);
```
rdrpenguin04 pushed a commit to rdrpenguin04/bevy that referenced this issue Jan 9, 2024
…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);
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-App Bevy apps and plugins A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Trivial Nice and easy! A great choice to get started with Bevy
Projects
None yet
2 participants