Loading Audio from Asset Bundles not working in Unity 5.2

After upgrading from Unity 4.6 from Unity 5.2, loading audio from asset bundles has stopped working.

Inside a coroutine, I load the AudioClips like this:

AudioClip audioClip = assetBundle.Bundle.LoadAsset(soundName, typeof(AudioClip)) as AudioClip;
yield return audioClip;

This used to work fine, but now this coroutine will finish without the AudioClip actually becoming playable. I can assign the audio clip to an audio source and Play() it without any exceptions being thrown, but the sound does not actually play and checking audioSource.isPlaying on the next line will return false.

I have tried calling audioClip.LoadAudioData() once the audio clip is loaded from the asset bundle and using a while loop to wait for audioClip.loadState to become “Loaded”. e.g.


while (audioClip.loadState == AudioDataLoadState.Unloaded)
     Debug.Log("Not Loaded");
     yield return null;

However, the audio clip remains in the “Unloaded” load state indefinitely. If I inspect the audio clip using a breakpoint, I can see all of the information about the sound such as bit rate, length, etc.

To add to this strangeness, if I close the app after downloading these bundles and reopen it, the sounds play without any problems.

Is anyone having similar issues?

We have the same issue as well. You can find what we’ve been able to dig up about the problem in this thread: https://forum.unity3d.com/threads/audioclip-loadaudiodata-returns-true-but-clip-remains-unloaded.455000/

Have you checked so that all the AudioClips get the same instanceID(per audio asset) or if loading the audio through www works as intended.

Also: Does your loading always work when you first start the application but breaks somewhere during load/runtime?