Search Issue Tracker
Fixed in 2021.3.40f1
Fixed in 2021.3.X, 2022.3.X, 6000.0.X, 6000.0.4f1
Votes
0
Found in
2021.3.34f1
2022.3.20f1
2023.2.9f1
2023.3.0b5
6000.0.0b11
Issue ID
UUM-61733
Regression
No
[Crash] Adding AudioListener component with OnAudioFilterRead crashes the editor
When removing the audio listener on a game object and adding it back, it crashes the editor if the game object has a script with OnAudioFilterRead attached to it.
Repro
- Download the attached `OAFR.cs` script.
- Create and open an empty project.
- Import the `OAFR.cs` script.
- In the SampleScene, add the OAFR component to Main Camera.
- Remove the audio listener component.
- Add an audio listener component.
- If the editor does not crash, do the following:
## Remove the OAFR component.
## Repeat steps 4-7
Expected: No error is thrown in the console and the editor does not crash
Actual: An error might be thrown in the console and sometimes the editor crashes.
Note
Sometimes the editor doesn't crash but an error is thrown in the console, which might hint at the problem.
Stack trace (crash)
See attached `Editor.log`.
Stack trace (error)
{code:java}
GameObject has multiple AudioSources and/or AudioListeners attached. While built-in filters like lowpass are instantiated separately, components implementing OnAudioFilterRead may only be used by either one AudioSource or AudioListener at a time.
The reason for this is that any state information used by the callback exists only once in the component, and the source or listener calling it cannot be inferred from the callback.
In this case the OnAudioFilterRead callback of script OAFR was first attached to a component of type AudioListener on the game object after which another component of type AudioListener tried to attach it.
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) {code}
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Reuse Collisions Callbacks is not enabled by default when opening a new project with HDRP template
- Bloom and Exposure Artifacting around GameObject appears when setting Scale of Z Axis to 0
- [Android][IL2CPP][ARMv7] Struct field value corrupts when invoking a generic delegate with a large struct by value
- Highlights persist throughout Options Panels in the Rendering Debugger Window
- Typing numbers in Matrix node’s numeric fields stretches Node
Resolution Note (fix version 6000.0):
Fixed a bug that would cause the editor to crash if you delete and then re-add an audio listener component.
Resolution Note (fix version 2022.3):
Fixed a bug that would cause the editor to crash if you delete and then re-add an audio listener component.
Resolution Note (fix version 2021.3):
Fixed a bug that would cause the editor to crash if you delete and then re-add an audio listener component.