Does UnityWebRequest just straight up not work for getting local files on Linux/Mac? I’m using stuff like UnityWebRequestTexture.GetTexture() to load textures from the local disc or UnityWebRequestMultimedia.GetAudioClip() to load audio, and it works perfectly fine on Windows and in the Editor, but on Mac/Linux it always fails to go through with UnityWebRequest.Result.ConnectionError along with the error message “Cannot connect to destination host”. I double checked the path with someone on native Linux, and it’s as it should be:
/home/yonaton/.config/unity3d/Arcy/TwinEdge/CustomSongs/Hellsnake No Way Back (arcy)/audio.wav as an example
Exact code I’m using for loading Audio:
public IEnumerator CreateAudioClip(Action callback = null, bool stream = true)
{
var extension = Path.GetExtension(audioPath);
if (extension != ".mp3" && extension != ".wav") Debug.LogError("Tried to load an audio file other than .mp3 or .wav");
var audioType = extension switch
{
".mp3" => AudioType.MPEG,
".wav" => AudioType.WAV,
_ => AudioType.UNKNOWN
};
using (var www = UnityWebRequestMultimedia.GetAudioClip(audioPath, audioType))
{
yield return www.SendWebRequest();
if (www.result == UnityWebRequest.Result.ConnectionError)
{
Debug.Log(www.error);
}
else
{
((DownloadHandlerAudioClip)www.downloadHandler).streamAudio = stream;
var loadedClip = DownloadHandlerAudioClip.GetContent(www);
clip = loadedClip;
}
}
yield return null;
callback?.Invoke();
}