Trait bevy_state::app::AppExtStates

source ·
pub trait AppExtStates {
    // Required methods
    fn init_state<S: FreelyMutableState + FromWorld>(&mut self) -> &mut Self;
    fn insert_state<S: FreelyMutableState>(&mut self, state: S) -> &mut Self;
    fn add_computed_state<S: ComputedStates>(&mut self) -> &mut Self;
    fn add_sub_state<S: SubStates>(&mut self) -> &mut Self;
    fn enable_state_scoped_entities<S: States>(&mut self) -> &mut Self;
}
Expand description

State installation methods for App and SubApp.

Required Methods§

source

fn init_state<S: FreelyMutableState + FromWorld>(&mut self) -> &mut Self

Initializes a State with standard starting values.

This method is idempotent: it has no effect when called again using the same generic type.

Adds State<S> and NextState<S> resources, and enables use of the [OnEnter], [OnTransition] and [OnExit] schedules. These schedules are triggered before Update and at startup.

If you would like to control how other systems run based on the current state, you can emulate this behavior using the [in_state] [Condition].

Note that you can also apply state transitions at other points in the schedule by triggering the StateTransition schedule manually.

source

fn insert_state<S: FreelyMutableState>(&mut self, state: S) -> &mut Self

Inserts a specific State to the current App and overrides any State previously added of the same type.

Adds State<S> and NextState<S> resources, and enables use of the [OnEnter], [OnTransition] and [OnExit] schedules. These schedules are triggered before Update and at startup.

If you would like to control how other systems run based on the current state, you can emulate this behavior using the [in_state] [Condition].

Note that you can also apply state transitions at other points in the schedule by triggering the StateTransition schedule manually.

source

fn add_computed_state<S: ComputedStates>(&mut self) -> &mut Self

Sets up a type implementing ComputedStates.

This method is idempotent: it has no effect when called again using the same generic type.

source

fn add_sub_state<S: SubStates>(&mut self) -> &mut Self

Sets up a type implementing SubStates.

This method is idempotent: it has no effect when called again using the same generic type.

source

fn enable_state_scoped_entities<S: States>(&mut self) -> &mut Self

Enable state-scoped entity clearing for state S.

For more information refer to StateScoped.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl AppExtStates for App

source§

impl AppExtStates for SubApp

Implementors§