Quantcast
Channel: Questions in topic: "webrequest"
Viewing all articles
Browse latest Browse all 387

Getting cast error from UnityWebRequest for an image

$
0
0
I am trying to load an image from a URL http://openweathermap.org/img/wn/{code}@2x.png. But I get cast error on loading IEnumerator GetWeatherImage(string imageCode) { Debug.Log($"Code received {imageCode}"); UnityWebRequest www = UnityWebRequest.Get($"openweathermap.org/img/wn/{imageCode}@2x.png"); yield return www.SendWebRequest(); if (www.isNetworkError || www.isHttpError) { Debug.Log(www.error); } else { Texture weatherTexture = DownloadHandlerTexture.GetContent(www); // cast error } } I tried pasting the URL in my browser and it works fine Also followed the docs

Viewing all articles
Browse latest Browse all 387

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>