Critical - Unity 2.6 - [url]www.bytes[/url] doesn't work in webplayer

Hello,

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 ?

Thanks

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.

I don’t want the duration of the download but the total bytes transferred by the www class.

Thanks again

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 problem is that the www.isDone is true and the www.bytes is not valid…

In unity 2.5.1, there is no problem, so how can I know if the download is finished with the 2.6 version ?

Thanks

I have the same problem.

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.

If something worked in v2.5 and now not in v2.6, it should be considered a bug - report it, especially since this is something you depend on.

-Will

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!

DocSWAB, if you want to provide a progress bar in terms of percent (not MB) you can still use www.progress. That still works fine.

With regards to the documentation: I totally agree. More and better docs would be a big time saver…