-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
AudioSink is not updated when audio source component is replaced #11862
Copy link
Copy link
Open
Labels
A-AudioSounds playback and modificationSounds playback and modificationC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behavior
Description
Bevy version
bevy = { version = "0.12.1"}What you did
Here is the code I have problems with:
To resume, I:
- create a custom audio source like in the "decodable" official example
- add it as a component to start playing it
- change the component with another audio source
- set a control on the space bar to play and pause the sink associated with the entity
What went wrong
I expected this code to play and pause the lowest-pitch sample.
But it plays nothing.
I tried a few other experiments (like rechanging the audio-source to the original one, and then it worked)
I found a way to do what I intended: forcing the sink to be destroyed when I change the source.
Discussion
I don't think it is the expected behaviour, or at least I think it is very confusing. My take is that the Sink should be removed when you insert an audio-source on an entity that already has one.
The user should know how the sinks are created and modified when the sources are spawned. Otherwise you quickly run into strange behaviours that are hard to debug.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-AudioSounds playback and modificationSounds playback and modificationC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behavior