pub trait CommandsStatesExt {
// Required method
fn set_state<S>(&mut self, state: S)
where S: FreelyMutableState;
}Expand description
Extension trait for Commands adding bevy_state helpers.
Required Methods§
Sourcefn set_state<S>(&mut self, state: S)where
S: FreelyMutableState,
fn set_state<S>(&mut self, state: S)where
S: FreelyMutableState,
Sets the next state the app should move to.
Internally this schedules a command that updates the NextState<S>
resource with state.
Note that commands introduce sync points to the ECS schedule, so modifying NextState
directly may be more efficient depending on your use-case.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.