Goal
I am trying to load a local .ogg file into AudioClip to play it back. However, I keep receiving an FMOD error.
The code I am using
private IEnumerator getAudio(string path) {
using (UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(path, AudioType.OGGVORBIS))
{
yield return www.SendWebRequest();
if (www.isHttpError || www.isNetworkError)
{
Debug.Log(www.error);
}
else
{
Debug.Log("Is done? " + www.isDone);
goAudioSource.clip = DownloadHandlerAudioClip.GetContent(www);
goAudioSource.Play();
}
}
}
The error message
Error: Cannot create FMOD::Sound instance for clip “” (FMOD error: Unsupported file or audio format. ) UnityEngine.Networking.DownloadHandlerAudioClip:GetContent(UnityWebRequest)
I already:
- Made sure that the .ogg file I am
using found via ‘path’ is a legit
.ogg and can be played back - Tried to add “file://” before the path
- Made sure that the www has finished downloading before accessing it
Any ideas what might be my problem here?
I am using Unity 2020.1.4f1.