bevy/crates/bevy_ecs/src
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
..
entity introduce EntityLocation::INVALID const and adjust Entities::get comment (#7623) 2023-02-18 21:15:57 +00:00
query Fix some typos (#7763) 2023-02-20 22:56:57 +00:00
schedule Support system.in_schedule() and system.on_startup() (#7790) 2023-02-24 18:33:55 +00:00
storage add len, is_empty, iter method on SparseSets, make SparseSets inspect… (#7638) 2023-02-15 23:52:02 +00:00
system Clean up marker generics for systems (#7789) 2023-02-23 05:11:12 +00:00
world Remove unnecessary clippy allows (#7768) 2023-02-20 23:59:03 +00:00
archetype.rs use bevy_utils::HashMap for better performance. TypeId is predefined … (#7642) 2023-02-15 04:19:26 +00:00
bundle.rs implement TypeUuid for primitives and fix multiple-parameter generics having the same TypeUuid (#6633) 2023-02-16 17:09:44 +00:00
change_detection.rs Deprecate ChangeTrackers<T> in favor of Ref<T> (#7306) 2023-02-19 16:19:56 +00:00
component.rs add len, is_empty, iter method on SparseSets, make SparseSets inspect… (#7638) 2023-02-15 23:52:02 +00:00
event.rs Don't log a trace if EventWriter::send_batch is empty (#7753) 2023-02-20 21:51:21 +00:00
lib.rs Fix some typos (#7763) 2023-02-20 22:56:57 +00:00
reflect.rs Rename UnsafeWorldCellEntityRef to UnsafeEntityCell (#7568) 2023-02-11 18:50:41 +00:00
removal_detection.rs Make RemovedComponents mirror EventReaders api surface (#7713) 2023-02-17 00:01:13 +00:00