The samples in the manual show using UnityWebRequest.isError method. Unfortunately (see the docs for that field) isError returns false when the web server returns an error such as 404 Not Found.
What would be a good way to determine if your web request succeeded in returning data that you can use? I’m thinking of something like this:
private bool IsFailedRequest(UnityWebRequest request)
{
return request.isError || (request.responseCode != (long)System.Net.HttpStatusCode.OK);
}
But I’m concerned that there may be other success status codes that I should be checking for. Also, although I’m getting 200 (HttpStatusCode.OK) back from a successful UnityWebRequest.Get, the result from a successful UnityWebRequest.GetAssetBundle call is returning 0 (not a status code). Is there a better way to check for success?