How to copy an image from App to external storage Unity Android?

Minapps

Member
Joined
Aug 13, 2019
Messages
7
Programming Experience
Beginner
How can I copy an image from my app to external storage with Unity Android ? I want to store an image in my app, and when the user clicks on a button it appears in the external storage. I found that I can use StreamingAssets or persistentDataPath but it looks like I can only read files from StramingAssets so I can't copy an Image. And I don't understand where my image is supposed to go in persistentDataPath and how it works. I've read the docs and looked on forums but can't find nor understand how to do it. This looked helpful for Streaming Assets :

Or is there a way to store the image as a sprite and then send the image into a file ?
 
Since your sprite is presumably already an array of bytes, why not just use the same code you pasted above for Write() but instead of converting the newData to JSON, and then from JSON to bytes, just save you byte data directly?
 
Back
Top Bottom