- Home /
UnityWebRequest returns different errors for right urls
I'm using UnityWebRequest to download asset bundles from my server. Sometimes the following code returns different exceptions such as Failed to receive data , Cannot resolve destination host, Cannot connect to destination host, Unknown Error, Request timeout and so on.
Here is the part of my code.
UnityWebRequest www = UnityWebRequestAssetBundle.GetAssetBundle(url,(uint)data.version,0);
Debug.Log ("Downloading " + url);
yield return www.SendWebRequest();
AssetBundle bundle = null;
if(www.isNetworkError || www.isHttpError) {
Debug.Log(www.isNetworkError);
Debug.Log(www.isHttpError);
Debug.Log(www.error);
if (ARSceneManager.Instance != null)
data.downloadAssetBundlesCompleted?.Invoke(null);
} else {
bundle = DownloadHandlerAssetBundle.GetContent(www);
}
if (!string.IsNullOrEmpty(www.error)) {
throw new Exception("WWW download: " + url + ", " + www.error);
}
So I get the errors for different urls and in some cases.
P.S. the same URL works for the next time, also it works in browser too. So I don't think there are issues with urls.
Thanks.
check the logs in the server if there are any, check when it happens if maybe when you are connected to wifi or something like that
Hi. I can't reproduce it on my end, I see errors in Bugsnag from users. Logs are clean.
that looks hard to debug, all those different erroors downloading the same asset bundle? same version?
Your answer
Follow this Question
Related Questions
Access raw AssetBundle data using UnityWebRequest? 4 Answers
How do I have multiple UnityWebRequests in one coroutine? 1 Answer
How to secure asset bundles from being used into another app? 0 Answers
Try catch alternative for HTTP request 1 Answer
How to create an assetbundle of an image folders and then load these images as texture? 0 Answers