- Home /
How to save Texture2d to album in android?
As title, I also found many way creating plugins, but I still don't figure out how to do?
I just want to save a Texture2D( already exist ) in album (internal or external is fine)
BTW It's so hard for me to work with android plugin, I can't understand
Thanks in advance..
Answer by Paulius-Liekis · May 22, 2012 at 07:01 PM
You don't need plugin for that. See Texture2D.EncodeToPNG (http://unity3d.com/support/documentation/ScriptReference/Texture2D.EncodeToPNG.html), it encodes texture to PNG and then you simply can save returned bytes.
Yes, I've done the same thing, but I can't find the android album path, or SD path. Actually I've done with iOS plugin using UIImageWriteToSavedPhotosAlbum.. Could you give me an exact idea about android?? Thanks :)
encode to png will give a byte array, how could it be saved as a png file?