Function bevy_state::state_scoped::clear_state_scoped_entities
source · pub fn clear_state_scoped_entities<S: States>(
commands: Commands<'_, '_>,
transitions: EventReader<'_, '_, StateTransitionEvent<S>>,
query: Query<'_, '_, (Entity, &StateScoped<S>)>
)
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.