bevy/examples/ecs
JoJoJet b8263b55fb Support system.in_schedule() and system.on_startup() (#7790)
# Objective

Support the following syntax for adding systems:

```rust
App::new()
    .add_system(setup.on_startup())
    .add_systems((
        show_menu.in_schedule(OnEnter(GameState::Paused)),
        menu_ssytem.in_set(OnUpdate(GameState::Paused)),
        hide_menu.in_schedule(OnExit(GameState::Paused)),
    ))
```

## Solution

Add the traits `IntoSystemAppConfig{s}`, which provide the extension methods necessary for configuring which schedule a system belongs to. These extension methods return `IntoSystemAppConfig{s}`, which `App::add_system{s}` uses to choose which schedule to add systems to.

---

## Changelog

+ Added the extension methods `in_schedule(label)` and  `on_startup()` for configuring the schedule a system belongs to.

## Future Work

* Replace all uses of `add_startup_system` in the engine.
* Deprecate this method
2023-02-24 18:33:55 +00:00
..
component_change_detection.rs Deprecate ChangeTrackers<T> in favor of Ref<T> (#7306) 2023-02-19 16:19:56 +00:00
custom_query_param.rs fix nightly clippy warnings (#6395) 2022-10-28 21:03:01 +00:00
ecs_guide.rs Fix panics in ecs_guide example (#7525) 2023-02-08 23:01:53 +00:00
event.rs Replace the bool argument of Timer with TimerMode (#6247) 2022-10-17 13:47:01 +00:00
fixed_timestep.rs Support system.in_schedule() and system.on_startup() (#7790) 2023-02-24 18:33:55 +00:00
generic_system.rs Support system.in_schedule() and system.on_startup() (#7790) 2023-02-24 18:33:55 +00:00
hierarchy.rs Base Sets (#7466) 2023-02-06 03:10:08 +00:00
iter_combinations.rs Support system.in_schedule() and system.on_startup() (#7790) 2023-02-24 18:33:55 +00:00
nondeterministic_system_order.rs Cleanup ScheduleBuildSettings (#7721) 2023-02-17 15:17:52 +00:00
parallel_query.rs Base Sets (#7466) 2023-02-06 03:10:08 +00:00
removal_detection.rs Base Sets (#7466) 2023-02-06 03:10:08 +00:00
run_conditions.rs Fix some more typos (#7767) 2023-02-20 23:36:28 +00:00
startup_system.rs Doc/module style doc blocks for examples (#4438) 2022-05-16 13:53:20 +00:00
state.rs Support system.in_schedule() and system.on_startup() (#7790) 2023-02-24 18:33:55 +00:00
system_closure.rs fix nightly clippy warnings (#6395) 2022-10-28 21:03:01 +00:00
system_param.rs Spawn now takes a Bundle (#6054) 2022-09-23 19:55:54 +00:00
system_piping.rs Remove Anyhow::Result in system_piping.rs example (#7657) 2023-02-14 03:33:47 +00:00
timers.rs Replace the bool argument of Timer with TimerMode (#6247) 2022-10-17 13:47:01 +00:00