Derive a States
type in an AppState
enum:
#[derive(Debug, Clone, Copy, Default, Eq, PartialEq, Hash, States)]
enum AppState {
#[default]
Menu,
InGame,
}
Using NextState
you can transition the apps state between the enum values:
fn start_game(
mut next_state: ResMut<NextState<AppState>>
) {
next_state.set(AppState::InGame);
}