|
Is it possible to store a texture(s) loaded at runtime for mobile platforms? It seems PlayerPrefs only supports shorter strings and numbers. Is using a storage engine like SQLite locally the only way?
(comments are locked)
|
|
You can put it in a file :) Save the file in persistentDataPath and you are good to go... If you really want to put it in PlayerPrefs then you can convert the byte representation of it to a string with Convert.ToBase64String() - note that this makes it bigger. Convert it back with Convert.FromBase64String(). Does persistentDataPath work across all mobile platforms? It seems that PlayerPrefs has a max filesize of 1 MB?
Jun 22 '12 at 09:29 AM
ina
Other question is, how do you query which persistentDataPath is writable on different Android devices? Or, is there a default one sandboxed for each app? Are there size constraints?
Jun 22 '12 at 09:30 AM
ina
hmm how do you get the byte representation of a Texture or Texture2D ?
Jun 23 '12 at 11:53 PM
ina
Sorry I missed your comments :( You get the bytes of a Texture by calling EncodeToPNG - which returns a byte array - or you can use the GetPixels32 (or GetPixels) to get something that is convertible to a byte array
Jun 24 '12 at 12:14 AM
whydoidoit
I believe that the latest releases of Unity (post 3.4) are consistent in the ability to use persistentDataPath. PlayerPrefs only has a maximum of 1MB on the web player - on everything else it is unlimited.
Jun 24 '12 at 12:15 AM
whydoidoit
(comments are locked)
|
