bevy/crates/bevy_app/src
Mike 33fdc5f5db
Move schedule name into Schedule (#9600)
# Objective

- Move schedule name into `Schedule` to allow the schedule name to be
used for errors and tracing in Schedule methods
- Fixes #9510

## Solution

- Move label onto `Schedule` and adjust api's on `World` and `Schedule`
to not pass explicit label where it makes sense to.
- add name to errors and tracing.
- `Schedule::new` now takes a label so either add the label or use
`Schedule::default` which uses a default label. `default` is mostly used
in doc examples and tests.

---

## Changelog

- move label onto `Schedule` to improve error message and logging for
schedules.

## Migration Guide

`Schedule::new` and `App::add_schedule`
```rust
// old
let schedule = Schedule::new();
app.add_schedule(MyLabel, schedule);

// new
let schedule = Schedule::new(MyLabel);
app.add_schedule(schedule);
```

if you aren't using a label and are using the schedule struct directly
you can use the default constructor.
```rust
// old
let schedule = Schedule::new();
schedule.run(world);

// new
let schedule = Schedule::default();
schedule.run(world);
```

`Schedules:insert`
```rust
// old
let schedule = Schedule::new();
schedules.insert(MyLabel, schedule);

// new
let schedule = Schedule::new(MyLabel);
schedules.insert(schedule);
```

`World::add_schedule`
```rust
// old
let schedule = Schedule::new();
world.add_schedule(MyLabel, schedule);

// new
let schedule = Schedule::new(MyLabel);
world.add_schedule(schedule);
```
2023-08-28 20:44:48 +00:00
..
app.rs Move schedule name into Schedule (#9600) 2023-08-28 20:44:48 +00:00
ci_testing.rs Take example screenshots in CI (#8488) 2023-05-01 18:00:01 +00:00
lib.rs Add SpawnScene to prelude (#9451) 2023-08-19 19:42:12 +00:00
main_schedule.rs Move schedule name into Schedule (#9600) 2023-08-28 20:44:48 +00:00
plugin.rs Add track_caller to App::add_plugins (#9174) 2023-07-23 01:02:20 +00:00
plugin_group.rs Add track_caller to App::add_plugins (#9174) 2023-07-23 01:02:20 +00:00
schedule_runner.rs Remove redundant check for AppExit events in ScheduleRunnerPlugin (#9421) 2023-08-28 17:13:02 +00:00