Function bevy::state::state_scoped::clear_state_scoped_entities
source · pub fn clear_state_scoped_entities<S>(
commands: Commands<'_, '_>,
transitions: EventReader<'_, '_, StateTransitionEvent<S>>,
query: Query<'_, '_, (Entity, &StateScoped<S>)>
)where
S: States,
Expand description
Removes entities marked with StateScoped<S>
when their state no longer matches the world state.
If bevy_hierarchy
feature is enabled, which it is by default, the despawn will be recursive.