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
- Package Manager lets some packages to be imported when everything in the package is deselected while other packages have the “Import” button greyed out
- The Blackboard scrolls up and selecting Items breaks when Duplicating Items in a scrolled down List
- "Curve" window workspace doesn't update the scale to match the selected curve preset unless reopened
- StackOverflowException occurs and tests fail to load when the Test Runner window is opened while System.Windows.Forms.dll and System.Deployment.dll are present in the project
- Some UXML Template Asset foldouts appear enabled when all fields inside are disabled
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.