You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Wanted to make system execution order (more) deterministic.
Did this by assigning systems to stages with app.add_system_to_stage
Got a white screen and the program froze on load with the warning WARN bevy_ecs::schedule::graph_utils: Chain(bevy_ecs::schedule::state::State<time::game_flow::GameState>::on_enter::{{closure}}, bevy_ecs::schedule::state::should_run_adapter<time::game_flow::GameState>) wants to be after unknown label: DriverLabel(TypeId { t: 3089577881103655877 })
Added a driver system set (don't understand how this works at all) with app.add_system_set_to_stage(CoreState::First, State::<my custom state enum>::get_driver())
That worked for CoreState::First
Want to do the same for CoreState::Last with state run criteria, repeat 3-4 for the new stage
Doesn't crash, but the run criteria never passes. Removing the run criteria the system runs every tick (want it to run on entry to a state)
Switched order of ...::get_driver() commands,
Systems in CoreStage::Last work, systems in CoreStage::First with run_criteria don't
What you expected to happen
Expected all systems to run
What actually happened
Systems get executed based on the order of the added stages. Only impacts systems with further run criteria and doesn't impact ones that always run in a stage.
Can't say I still understand how it works, but I added the state to some more stages and changed from app.add_state to app.add_state_to_stage and now State::on_update seems to work, while State::on_enter doesn't. I can work with this, although I'd really wish for an explanation.
States that work across multiple stages are very much a fragile hack, so I'm unsurprised that this broke in surprising ways. I think that the reason the on-enter doesn't work properly is because the state already decides that entry is complete at the end of the first stage that it has been entered in.
This will almost certainly just be fixed / obsoleted by the stageless redesign: bevyengine/rfcs#45.
Bevy version
0.6 off of crates.io
Operating system & version
Windows 10.
What you did
app.add_system_to_stage
WARN bevy_ecs::schedule::graph_utils: Chain(bevy_ecs::schedule::state::State<time::game_flow::GameState>::on_enter::{{closure}}, bevy_ecs::schedule::state::should_run_adapter<time::game_flow::GameState>) wants to be after unknown label: DriverLabel(TypeId { t: 3089577881103655877 })
app.add_system_set_to_stage(CoreState::First, State::<my custom state enum>::get_driver())
CoreState::First
CoreState::Last
with state run criteria, repeat 3-4 for the new stage...::get_driver()
commands,CoreStage::Last
work, systems inCoreStage::First
with run_criteria don'tWhat you expected to happen
Expected all systems to run
What actually happened
Systems get executed based on the order of the added stages. Only impacts systems with further run criteria and doesn't impact ones that always run in a stage.
Additional information
Snippet from the plugin that adds the state:
Usage:
The text was updated successfully, but these errors were encountered: