- Home /
Question by
erasmolbj · Jan 08, 2019 at 11:59 PM ·
3dloadwebrequestlocalhost
UnityWebRequestMultimedia dosent load local file MacOS
I use UnityWebRequestMultimedia to load files from localDrive on this piece of code. But, on MacOS he tries to Load at localhost. How can i change this?
Song.Audio audio = new Song.Audio();
FileInfo guitarFileInfo = new FileInfo(song.fileInfo.Directory.FullName + "/guitar.ogg");
if (guitarFileInfo.Exists)
{
using (UnityWebRequest uwr = UnityWebRequestMultimedia.GetAudioClip(guitarFileInfo.FullName, AudioType.OGGVORBIS))
{
yield return uwr.SendWebRequest();
if (uwr.isNetworkError || uwr.isHttpError)
{
Debug.LogError(uwr.error);
yield break;
}
yield return null;
audio.guitar = DownloadHandlerAudioClip.GetContent(uwr);
}
}
captura-de-tela-2019-01-08-as-215204.png
(337.5 kB)
captura-de-tela-2019-01-08-as-215232.png
(350.2 kB)
Comment
Answer by lithiumsanxiety · Jan 25, 2020 at 10:10 PM
@erasmolbj This also affects UnityWebRequest on linux. On linux I can workaround by prefixing the file path with "file://". ie pass "file:///home/user/file.txt" instead of "/home/user/file.txt" as the url parameter.