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
- Static Editor Flags dropdown list is cut off when Inspector Window is docked to the very right and UI Scaling is set to a higher value
- visionOS Players are minimized when Guided Access is turned on
- Licensing Client fails to launch when opening Unity Hub
- Sprite Atlas Inspector preview disappears when entering Play mode unless SpriteAtlasMode is set to "Sprite Atlas V2 - Enabled"
- Opening reference for Audio Importer opens missing page
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.