Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs reflect that RemovalDetection also yields despawned entities #11795

Merged
merged 1 commit into from
Feb 10, 2024

Conversation

porkbrain
Copy link
Contributor

Objective

I want to keep track of despawned entities.
I am aware of RemovedComponents.
However, the docs don't explicitly mention that despawned entities are also included in this event iterator.
I searched through the bevy tests to find removal_tracking in crates/bevy_ecs/src/system/mod.rs that confirmed the behavior:

            ...
            assert_eq!(
                removed_i32.read().collect::<Vec<_>>(),
                &[despawned.0],
                "despawning causes the correct entity to show up in the 'RemovedComponent' system parameter."
            );
            ...

Solution

  • Explicitly mention this behavior in docs.

Copy link
Contributor

@shanecelis shanecelis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure about the despawn behavior, so I double checked it, and it's right. TIL. Approved.

@james7132 james7132 added this pull request to the merge queue Feb 10, 2024
Merged via the queue into bevyengine:main with commit 0031391 Feb 10, 2024
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants