Search code examples
imageunity-game-enginedownloadtextureshosting

Cannot Download Image from URL in Mobile Devices Using Unity


I am having trouble downloading pictures on my mobile devices.

I use this code for downloading down below:

public IEnumerator DownloadImageRaw(string MediaUrl, RawImage poster)
{
    UnityWebRequest request = UnityWebRequestTexture.GetTexture(MediaUrl);
    request.SendWebRequest();
    if (request.isNetworkError || request.isHttpError)
    {
        poster.texture = Resources.Load<Texture2D>("images/NoPoser");
        Debug.Log(request.error);
        yield break;
    }
    else
    {           
        poster.texture = ((DownloadHandlerTexture)request.downloadHandler).texture;
    }
}

Link A:https://m.media-amazon.com/images/M/MV5BZmVmYTE2OGEtMTkzOC00YzNiLTlhYWQtZDFiMmJiZDBmNTAwXkEyXkFqcGdeQXVyMTMxODk2OTU@._V1_SX300.jpg

Link B: http://www.subzerone.com/nfp/poser/1.jpg

if I use "Link A" for MediaUrl, working in all devices (Unity Editor,Nox Player,My Mobile Phone).

But "Link B" just doesn't work on my mobile phone.

"Link B" Work perfect on Unity Editor and Nox Player.

What am I doing wrong?


Solution

  • Problem is Unity 2018 Versions.

    i upgraded my project 2019. problem is solved.