How it will look in new UnityWebrequest?
string result = String.Empty;
while (connectionRetries < maxRetries)
{
WWW www = new WWW(mySite.url);
while (!www.isDone)
yield return null;
if (!string.IsNullOrEmpty(www.error))
{
connectionRetries++;
Debug.LogWarning("Error Loading My Site " + mySite.url + ". Retrying connection " + connectionRetries);
errorMessage = www.error;
}
else
{
result = www.text;
break;
}
}
It does work like this, but when i try changing to UnityWebRequest it doesnt. Can’t fetch site as string.
string result = String.Empty;
while (connectionRetries < maxRetries)
{
UnityWebRequest www = UnityWebRequest.Get("mySite.url");
while (!www.isDone)
yield return null;
if (!string.IsNullOrEmpty(www.error))
{
connectionRetries++;
Debug.LogWarning("Error Loading My Site " + mySite.url + ". Retrying connection " + connectionRetries);
errorMessage = www.error;
}
else
{
result = www.downloadHandler.text;
break;
}
}
Also tried:
result = www.downloadHandler.text.ToString();
Help?