x


What is the best way to persist www downloaded graphics?

While this question is probably not Unity specific ...

In my game I would like use www class to import texture2D. After they are downloaded and in use what is the suggested method to cache/persist these graphics for future use.

Is sqlite overkill?

iByte

Based on SpikeX question below I have added the following information:

My game will ship with a specific set of graphics. I want these graphics to be updateble over the web (the amount of space required would not change). When the player closes the game I don't want the new graphics to turn into dispersed electrons. I want the graphics to be reloaded into the game (locally) when it starts up again. It would be okay if the original graphics were overwritten if there was a way to do that. If not then I am assuming I need some kind of file storage file or simple blob like database to keep them in. I would hope to support any type of Unity deployment target with whatever solution was used.

more ▼

asked Mar 17 '10 at 11:04 PM

ibyte gravatar image

ibyte
529 12 18 27

"In my game I would like use www class to import texture2D."

Could you be a little more specific? Typically with games you just have an asset database that everything grabs from, and is packaged with your game. Unity also handles automatic streaming of web content using the web player if that's what you're trying to do.

Mar 17 '10 at 11:11 PM qJake
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

You can save downloaded textures with the usual http://System.IO functions, such as WriteAllBytes, plus the use of Application.DataPath. Note that this only works with standalones; you can't cache anything locally with webplayers, aside from 1MB of PlayerPrefs data. (Unless you get a special license from UT that allows caching in webplayers.)

more ▼

answered Mar 18 '10 at 12:01 AM

Eric5h5 gravatar image

Eric5h5
80.1k 41 132 519

Note that from Unity3.3 you can use Application.persistentDatapath. This works on all devices (except web); see http://www.previewlabs.com/file-io-in-unity3d/

May 19 '11 at 12:29 PM bernardfrancois

Does this also work for mobile? Or do you just save that in PlayerPrefs

Dec 19 '11 at 03:26 AM ina
(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
x353
x9

asked: Mar 17 '10 at 11:04 PM

Seen: 1481 times

Last Updated: Dec 19 '11 at 03:26 AM