Hi all,
So I’m retrieving info from a Google Sheet, including URLs to images. I have no problem receiving the info, and when I look at the list of URLs in the inspector they seem to be valid, but when I UnityWebRequest.GetTexture(url) from my URL List I get “Cannot connect to destination host”, whereas when I UnityWebRequest.GetTexture(“https://via.placeholder.com/600/92c952”) it loads just fine.
Is there some sort of reformatting needed? Or what could be the case? Thanks!
For reference:
IEnumerator GetTextureRequest(string url, GameObject item)
{
//url = UnityWebRequest.EscapeURL(url); //tried this, no luck
using (UnityWebRequest www = UnityWebRequestTexture.GetTexture(url)) //this way returns the error
//using (UnityWebRequest www = UnityWebRequestTexture.GetTexture("one of the image urls I'm using.jpg")) //this way works, but is obviously unusable
{
yield return www.SendWebRequest();
if (www.isNetworkError || www.isHttpError)
{
Debug.Log(www.error);
}
else
{
if (www.isDone)
{
var texture = DownloadHandlerTexture.GetContent(www);
var rect = new Rect(0, 0, 60f, 60f);
var sprite = Sprite.Create(texture, rect, new Vector2(0.0f, 0.0f));
var images = item.GetComponentsInChildren<Image>();
images[1].sprite = sprite;
}
}
}
}