Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Audio AssetBundle Audio clips in WebGL

Discussion in 'Audio & Video' started by mikec29, Apr 27, 2020.

  1. mikec29

    mikec29

    Joined:
    Aug 7, 2018
    Posts:
    11
    I have an assetbundle of audio files that is loaded into an AudioClip array, however the loadState of every AudioClip is false, as is isReadyToPlay. I am building for WebGL and I can’t figure out how to make these files playable, I always get the following error: “Cannot create FMOD::Sound instance for clip”.

    My code is as follows:

    Code (CSharp):
    1. using (UnityWebRequest uwr =
    2.             UnityWebRequestAssetBundle.GetAssetBundle(uri, cachedAssetBundle, hash))
    3.         {
    4.             yield return uwr.SendWebRequest();
    5.             if (string.IsNullOrEmpty(uwr.error))
    6.             {
    7.                 if (ReferenceEquals(m_assetBundle, null))
    8.                 {
    9.                     m_assetBundle = DownloadHandlerAssetBundle.GetContent(uwr);
    10.                     LoadMusicAssets();
    11.                 }
    12.             }
    13.  
    14.         }
    15.  
    16. private void LoadMusicAssets()
    17.     {
    18.         if (m_assetBundle != null)
    19.         {
    20.             m_musicAudio = m_assetBundle.LoadAllAssets<AudioClip>();
    21.             if (m_ musicAudio!= null)
    22.             {
    23.                 MusicSource.PlayOneShot(m_musicAudio[0]);
    24.             }
    25.        }
    26. }
     
  2. eyalfx

    eyalfx

    Joined:
    Oct 8, 2010
    Posts:
    108
    Same issue here... did you find a workaround ?