[Merged by Bors] - Support system.in_schedule() and system.on_startup()#7790
[Merged by Bors] - Support system.in_schedule() and system.on_startup()#7790joseph-gio wants to merge 41 commits intobevyengine:mainfrom
system.in_schedule() and system.on_startup()#7790Conversation
This reverts commit 9a80674.
|
Alright, I've removed the state extension methods for now. We'll let the design for them cook a little more. I also replaced every usage of I think we should also deprecate |
system.in_schedule() and system.on_enter(state)system.in_schedule() and system.on_startup()
Agreed on both counts. With the state API cut, I've removed the controversial label and feel good about getting this in. |
|
Example |
|
It seems to work fine on my machine. What does it mean when |
|
I think the bot is just slow. |
|
I realized that we probably don't want to expose |
# 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
|
Pull request successfully merged into main. Build succeeded:
|
system.in_schedule() and system.on_startup()system.in_schedule() and system.on_startup()
Accomodate for bevyengine/bevy#7790
Accomodate for bevyengine/bevy#7790
…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
Objective
Support the following syntax for adding systems:
Solution
Add the traits
IntoSystemAppConfig{s}, which provide the extension methods necessary for configuring which schedule a system belongs to. These extension methods returnIntoSystemAppConfig{s}, whichApp::add_system{s}uses to choose which schedule to add systems to.Changelog
in_schedule(label)andon_startup()for configuring the schedule a system belongs to.Future Work
add_startup_systemin the engine.