Skip to content

DespawnOnEnter/DespawnOnExit no longer working on Observers #21579

@Ceedrich

Description

@Ceedrich

Bevy version and features

Version 0.17

What you did

Since #20204, can no longer be despawned by using the DespawnOnEnter/DespawnOnExit components. This is due to them being Internal entities and thus they are not queried in the systems responsible for despawning entities.

pub fn despawn_entities_on_exit_state<S: States>(
mut commands: Commands,
mut transitions: MessageReader<StateTransitionEvent<S>>,
query: Query<(Entity, &DespawnOnExit<S>)>,
) {

pub fn despawn_entities_on_enter_state<S: States>(
mut commands: Commands,
mut transitions: MessageReader<StateTransitionEvent<S>>,
query: Query<(Entity, &DespawnOnEnter<S>)>,
) {

Is this intended or should observers be able to be despawned?

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-BugAn unexpected or incorrect behaviorS-Needs-TriageThis issue needs to be labelled

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions