Function bevy::prelude::state_changed

pub fn state_changed<S>() -> impl FnMut(Res<'_, State<S>>)where
    S: States,
Expand description

Generates a Condition-satisfying closure that returns true if the state machine changed state.

To do things on transitions to/from specific states, use their respective OnEnter/OnExit schedules. Use this run condition if you want to detect any change, regardless of the value.

Panics

The condition will panic if the resource does not exist.