- Home /
 
Unitywebrequest returns fmod error
I'm trying to make an audioloader so the user can choose his/her own music, but i'm running into a problem i don't know how to solve. Whatever audioformat i try, unity will always say the file format is not supported. I'm currently using 2018.2, but in earlier versions unity would just give me a blank error and not tell me anything. Here's my code, i copied the entire thing straight from this https://docs.unity3d.com/ScriptReference/Networking.UnityWebRequestMultimedia.GetAudioClip.html, and added a delay so the requester can finish downloading, any ideas? The file does exist, it plays when i click it.
 IEnumerator GetAudioClip(string directory)
 {
     using (UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip("file://D:/audio.wav", AudioType.WAV))
     {
         
         yield return www.SendWebRequest();
         while (!www.isDone)
         {
             yield return new WaitForEndOfFrame();
         }
         if (www.isNetworkError)
         {
             Debug.Log(www.error);
         }
         else
         {
             AudioClip myClip = DownloadHandlerAudioClip.GetContent(www);
             transform.GetComponent<AudioSource>().clip = myClip;
             transform.GetComponent<AudioSource>().Play();
         }
     }
 }
 
              Hey there,
Just wanted to know if you found any solution, I'm having the exact same problem and have no idea what's happening ... Thanks !
has anyone found a fix?
 Error: Cannot create F$$anonymous$$OD::Sound instance for clip "" (F$$anonymous$$OD error: Unsupported file or audio format. )
 UnityEngine.Networking.DownloadHandlerAudioClip:GetContent(UnityWebRequest)
 <LoadClip>d__4:$$anonymous$$oveNext() (at Assets/Scripts/Load$$anonymous$$usic.cs:48)
 UnityEngine.UnitySynchronizationContext:ExecuteTasks()
                 Your answer