- Home /
Is there a way to save a texture to the iPhone/iPad?
In the PC/Mac versions, I save the image using the following function.
var text2D : Texture2D = rs_render.texture;
var bytes =text2D.EncodeToPNG();
File.WriteAllBytes(Application.dataPath + "/../"+filename,bytes);
Is there a way to save the image/texture to the iPhone/iPad photo library?
Answer by Tetrad · Jul 29, 2010 at 03:01 AM
Not without a native code plugin.
You would basically have to do something like what you're doing now (but writing to the temp folder in the iphone file system, which you'll probably have to get the path of by using some native code call that I don't remember off the top of my head).
Once you do that, you can load that file into a UIImage (using imageWithContentsOfFile:
probably), and then use the standalone function UIImageWriteToSavedPhotosAlbum
.
For more info see here: http://stackoverflow.com/questions/1282830/uiimagepickercontroller-uiimage-memory-and-more/1517137#1517137
Answer by BerggreenDK · Dec 21, 2011 at 07:20 PM
My guess would be that you can write the binary data to the Apps document folder and then load it back into a texture through WWW with a path that begins with file://
Your answer
Follow this Question
Related Questions
For iPhone: Multiple small textures or one large texture for towers in a Tower Defense game? 2 Answers
Low frame rate with only one texture on iPad 4 Answers
How to save runtime generated texture in Webplayer to hard drive? 1 Answer
Is it possible to compress textures per device 0 Answers
Dynamically choosing a high resolution texture at runtime on iOS devices 1 Answer