I have a problem, I need to know dowloads size in my application. I use the www.bytes.length in unity 2.5.1 and it works well even for bundle (all my application data are bundles).
The same code in Unity 2.6 editor works but in webplayer it doesn’t.
I detect that’s www.bytes is not null but the size is near zero ??
So, have you an idea in what happens or another solution for calculating the bandwidth of the application ?
With 2.6, the WWW class became threaded.
As such, the time it needs for download depends on the thread priority you give it.
the less priority, the longer it will take for downloading stuff.
The data you find in there are the total bytes transfered.
if you didn’t put it on high priority, then it will download data slowly and as such the amount of data won’t be too high.
I’m though not sure if you can read out the data at all until they are completely downloaded.
The bytes and size of a WWW object did work in 2.5. Since I upgraded to 2.6 it doesnt work anymore in the browser. Even if the download is finished I get 0 for both bytes.Length and size.
It sounds like a bug…?
Is there a workaround?
It would be important to see how much data had to be loaded.
once the download is finished, it really should show up correctly.
during download its a whole different story as that would require locking the whole stuff which would block the download, totally killing the threaded approach
dreamora, yes I totally agree with you :).
During the download it doesnt need to show up but at the end it should.Though for us it doesnt seem to work since 2.6. :(.
Shouldnt in either case the behaviour of download bytes and size be the same in the Editor as in the webplayer? Since it does work in the editor.
www.isDone doesn’t report anything during download (that is, it can’t be tested in a while loop anymore).
www.error never reports anything, including a file not found error, even after the download is complete or fails.
(bug reports filed about these)
The documentation doesn’t shed much light on how the threading has changed this, except to say you should now use yield to wait for the download to complete instead of checking isDone.
But if bytes and isDone don’t update during the download anymore, how could you provide a progress bar or decide your download is stuck and bail out?
Some further enlightenment on what’s to be expected and more sample code and docs would be a huge help!