• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by ibyte · Mar 17, 2010 at 11:04 PM · wwwtexture2dpersist

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.

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image qJake · Mar 17, 2010 at 11:11 PM 0
Share

"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.

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Eric5h5 · Mar 18, 2010 at 12:01 AM

You can save downloaded textures with the usual 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.)

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image bernardfrancois · May 19, 2011 at 12:29 PM 0
Share

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/

avatar image ina · Dec 19, 2011 at 03:26 AM 0
Share

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

Your answer

Hint: You can notify a user about this post by typing @username

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

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

Disabling mipmaps for downloaded textures 1 Answer

Transparency showing as black - textures and images loaded using www 1 Answer

NGUI 3.4.9 error NullReferenceException UnityEngine.Material..ctor (UnityEngine.Shader shader) UIDrawCall.CreateMaterial () 0 Answers

How to load an image at runtime via WWW correctly 1 Answer

!texture.texture error 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges