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
I'm starting learning new states in Bevy. I tried the following code, assuming that when using 2 states, I could manage both when defining set and scheduling :
use bevy::prelude::*;#[derive(States,Debug,Clone,Copy,Eq,PartialEq,Hash,Default)]enumAppState{#[default]MainMenu,InGame,}#[derive(States,Debug,Clone,Copy,Eq,PartialEq,Hash,Default)]enumSimulationState{Running,#[default]Paused,}#[test]fntest_multiple_states(){letmut app = App::new();
app.add_state::<AppState>().add_state::<SimulationState>().add_system(
spawn_pause_menu
.in_set(OnUpdate(AppState::InGame)).in_schedule(OnEnter(SimulationState::Paused)),).run();fnspawn_pause_menu(mut_commands:Commands){panic!("Pause menu spawned");}}
What went wrong
Here, the test failed, because the pause menu was spawn but the AppState is not InGame, but MainMenu. I suppose that the spawn_pause_menu is called because it entered SimulationState::Paused, not checking the in_set(OnUpdate(AppState::InGame)). Is that expected? If the answer is yes, I would like an explanation on how should I manage this case.
The text was updated successfully, but these errors were encountered:
Bevy version : 0.10 on Win10-64
What you did
I'm starting learning new states in Bevy. I tried the following code, assuming that when using 2 states, I could manage both when defining set and scheduling :
What went wrong
Here, the test failed, because the pause menu was spawn but the AppState is not InGame, but MainMenu. I suppose that the
spawn_pause_menu
is called because it enteredSimulationState::Paused
, not checking thein_set(OnUpdate(AppState::InGame))
. Is that expected? If the answer is yes, I would like an explanation on how should I manage this case.The text was updated successfully, but these errors were encountered: