www.progress is 1 even www.error happened??

Hi All

I am new to here and I want to know whether anyone can help

I use a WWW like the following:

WWW www = new WWW(request.url);

yield return www;

if(www.error!=null && www.error!="") { Debug.Log( www.progress ); }

and I find that most of the time the progress is 1 when there error downloading. But I assume that 1 mean that whole item is already downloaded. so what exactly www.progress mean??? Thx!

It means that it's finished trying to download. If there is an error, it'll give you back a progress of 1 because it's finished attempting to access the url

Browsers do the exact same thing - they'll show a loading bar when you go to a url, and increase the progress while downloading data, and show progress complete on either error (e.g. 404) or the page is done

Thx for detailed explanation. :P

No, progress is the real progress of the download. It's 1 because the download is finished. That's because you use:

yield return www;

that actually waits until the download is finished. If you don't use the coroutine with yield you can check "isDone" or "progress" in your Update() ( or FixedUpdate() ) function.

edit sure, if you request a resource from a server, the server always will respond (at least when the server is available). The respond could be the file/data you want or an error page (like Mike said). The progress and isDone property is just related to this respond. To see if the request was successful you have to check the error property after the "download" isDone! ;)