x


Question regarding where WWW stores content

This is more of a question regarding how files are stored when downloading them through the WWW class. Once a file is successfully downloaded from a server using WWW, is the file placed some place physically on the client side, or is everything just stored in a big cache blob of some kind?

I also noticed that the time taken to download the file also doesn't correspond to actually accessing the data in the file. In other words, if I download about 50 1 MB files, they all download, according to my logs and WWW's isDone and error != null property, along with some timestamps, within 1 second. However, when I actually go to access the texture through the texture property, there seems to be additional lag, so it's like the physical contents of the file are getting loaded at that point? Also, the memory seems to drop a lot at this point, so I'm guessing this is when the actual Texture2D is allocated? If so, what is in the WWW object before this access is done that takes up so much less space?

The last question is, eventually, after accessing about 20 of these files (~29 MB from my calculations), the unity run browser crashes due to being out of memory (d3d: out of memory). If I don't access the texture property at all, and just store the WWW objects by their lonesome, I don't have any out of memory crash. Is this the purpose of downloading an entire AssetBundle, to sort of cram more data into a compressed bundle to save memory in this instance? Also, would there be a way to free up that Texture2D if I don't need it anymore? The texture property is readonly, so I can't set it to null afterwards, and I wouldn't want to null out the WWW, since then I take it the downloaded file itself is then no longer accessible?

more ▼

asked Feb 23 '12 at 11:14 PM

cwodarcz gravatar image

cwodarcz
1 2 2

Split this up into multiple questions.

Feb 24 '12 at 04:53 AM rabbitfang
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Where is it stored: nowhere. if it runs in the browser, the browser might store it but thats up to the browser.

Lag on load: Thats correct, www.texture will load the image. before this point its only meaningless byte blob data. Also keep in mind that when meshes / textures are rendered for the first time, they need to be uploaded to vram, thats a blocking process, the heavier the asset is the longer it goes. For asset bundles, the accessing to them kicks of the 7zip decompression as asset bundles are 7zip compressed

Crash: thats expected if you don't unload the asset bundle, at least if the graphics chip is low on VRAM. If you destroy the texture that won't change anything, you need to unload the bundle too as it keeps the texture alive.

more ▼

answered Feb 26 '12 at 09:22 AM

Dreamora gravatar image

Dreamora
3.2k 1 4 25

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x525
x80
x24

asked: Feb 23 '12 at 11:14 PM

Seen: 466 times

Last Updated: Feb 26 '12 at 09:22 AM