I have a Unity project where I'm trying to scrape images from websites but some of the URL's that I try to download images from don't work. So for example, if I try to use UnityWebRequestTexture.GetTexture() with this URL (https://cdn.shopify.com/s/files/1/1963/1339/files/G20-full-right-front.jpg) I'm able to download the image but if I use this URL (https://pisces.bbystatic.com/image2/BestBuy_US/images/products/6427/6427116_sd.jpg) I get nothing
I've stepped through the code in a debugger and when I call www.SendWebRequest(); it never returns so I never get a HTTP error or a response.
Here is my code:
private IEnumerator LoadImage(string url)
{
using (var www = UnityWebRequestTexture.GetTexture(url))
{
yield return www.SendWebRequest();
if (www.isNetworkError)
{
Debug.Log(www.error);
}
else
{
Texture2D texture = null;
try
{
texture = DownloadHandlerTexture.GetContent(www);
}
catch (Exception)
{
Destroy(gameObject);
yield break;
}
// do something with the texture
...
}
}
}
I'm guessing there is some kind of CORS issue or else some kind of SSL cert issue. But I don't know what I could do to solve these issues.