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

Fix leftover references to children when despawning audio entities #12407

Merged
merged 2 commits into from
Mar 11, 2024

Conversation

rparrett
Copy link
Contributor

@rparrett rparrett commented Mar 10, 2024

Objective

Fixes #12402

Solution

Use despawn_recursive instead of despawn for despawning PlaybackMode::Despawn audio.

Migration Guide

PlaybackSettings::DESPAWN (PlaybackMode::Despawn) now despawns the audio entity's children as well. If you were relying on the previous behavior, you may be able to use PlaybackMode::Remove, or you may need to use PlaybackMode::Once and manage your audio component lifecycle manually.

@rparrett
Copy link
Contributor Author

Not able to test this morning. Would appreciate someone making sure this works properly.

@rparrett rparrett force-pushed the audio-despawn-recursive branch from 6c3d3ee to 0d15411 Compare March 10, 2024 13:49
Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

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

We should document this behavior in the PlaybackMode variant's documentation :)

@TrialDragon TrialDragon added C-Bug An unexpected or incorrect behavior A-Audio Sounds playback and modification labels Mar 10, 2024
@james7132 james7132 added the M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide label Mar 10, 2024
Copy link
Contributor

It looks like your PR is a breaking change, but you didn't provide a migration guide.

Could you add some context on what users should update when this change get released in a new version of Bevy?
It will be used to help writing the migration guide for the version. Putting it after a ## Migration Guide will help it get automatically picked up by our tooling.

@james7132 james7132 added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Mar 11, 2024
@mockersf mockersf added this pull request to the merge queue Mar 11, 2024
Merged via the queue into bevyengine:main with commit c9e3285 Mar 11, 2024
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Audio Sounds playback and modification C-Bug An unexpected or incorrect behavior M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

AudioBundle with PlaybackSettings::Despawn leaves trash entities if Parented to something
5 participants