Search Issue Tracker
Fixed
Fixed in 2021.3.38f1, 2022.3.27f1, 2023.2.20f1, 6000.0.0f1
Votes
4
Found in
2021.3.10f1
2022.1.16f1
2022.2.0b8
2023.1.0a10
2023.2.0a1
Issue ID
UUM-14330
Regression
No
Crash on purecall when an audio source is trying to play a destroyed clip
*Reproduction steps:*
# Open the attached project "Download Audio Crash".
# Enter play mode.
# Press spacebar.
# Press backspace.
Expected: The editor doesn't crash and the editor throws an error. If using DestroyImmediate, the audio source should stop outputting sound.
Actual: The audio source continues outputting sound for a destroyed audio clip and the editor crashes after a few seconds.
{*}Reproducible on{*}: 2021.3.35f1, 2022.3.20f1, 2023.2.13f1, 2023.3.0b10
{*}Reproduced on{*}: Windows 10, Windows 11, MacOS (M1)
*Note*
* In the attached project "Download Audio Crash", you can change the Using Resources Load boolean to true on the game object script to test what happens if using that method instead.
* This error happens when using Resources.Load instead, and could be the expected results. However, the user can use DestroyImmediate to repro the error, so there should be a safe guard in place where the audio source is trying to play a clip that has been deleted.
Expected error:
{code:java}
Destroying assets is not permitted to avoid data loss.
If you really want to remove an asset use DestroyImmediate (theObject, true);
UnityEngine.Object:Destroy (UnityEngine.Object)
StreamAudio:Update () (at Assets/StreamAudio.cs:27) {code}
* If using Resources.Load and DestroyImmediate, the audio source actually stops outputting sound immediately when the clip is destroyed.
{*}First few lines of the Stacktrace (Windows){*}:
{code:java}
(Unity) purecall
(Unity) AudioClip::WWWRead
(Unity) FMOD::UserFile::reallyRead
(Unity) FMOD::UserFile::reallyAsyncRead
(Unity) FMOD::FileThread::threadFunc{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
- Rendering locks up when not looking at a transparent material on Meta Quest 2
- Volumetrics break when using a Custom Pass to create a Thickness Buffer for Alpha Clipping
- All tests are run instead of only the failed ones when the "Rerun Failed" button is pressed
- GameObject is not masked when the "Render PostProcessing Effects" pass executes with a resolved non-MSAA Color target and MSAA DepthStencil target
- [Android] Gfx.WaitForGfxCommandsFromMainThread high performance usage and inconsistency when built Player scene has Canvas GameObject on a specific Project
Resolution Note (fix version 2023.2.20f1):
Audio: Fixed an issue that would cause Unity to crash when you manually destroy a streamed audio clip.