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 have two state enums: AppState and GameState. I need to guarantee that OnEnter(GameState::Y) is executed in the same tick as OnEnter(AppState:X) when NextState<GameState> is changed to GameState::Y in a system run in OnEnter(AppState:X).
I have come up with the following solution:
let app_set = apply_state_transition::<AppState>.into_system_set();let game_set = apply_state_transition::<GameState>.into_system_set();
app.add_state::<AppState>().add_state::<GameState>().configure_sets((game_set, app_set).chain());
Does that work as I expect? If not, why? What is the canonical solution?
BTW I think that this can be a common pattern (one state depending another / a kind of a hierarchy).
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I have two state enums:
AppState
andGameState
. I need to guarantee thatOnEnter(GameState::Y)
is executed in the same tick asOnEnter(AppState:X)
whenNextState<GameState>
is changed toGameState::Y
in a system run inOnEnter(AppState:X)
.I have come up with the following solution:
Does that work as I expect? If not, why? What is the canonical solution?
BTW I think that this can be a common pattern (one state depending another / a kind of a hierarchy).
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions