- Home /
I need to set the path for saving the pictures with an application for Android and IOS
My actual code:
function Update() { if(Input.GetMouseButtonDown(0)) { Debug.Log("foto");
Application.CaptureScreenshot(Application.dataPath + "Screenshot.png");
} }
I need the path for the output of every photo for this function.
Thanks!
Answer by whydoidoit · Jul 24, 2012 at 06:00 PM
You probably don't want to use the same file each time, you also need to prepend a "/" to the file name and you should use Application.persistentDataPath rather than dataPath.
It might be worth creating a unique name like this:
var name = System.Guid.NewGuid().ToString();
The path is different on different devices I believe. If you want to know what it is on a particular device then Debug.Log(Application.persistentDataPath).
The problem is that i want to change the default path.
Thanks for the answer but the problem is not solved yet.
You can't write anywhere else on the device apart from there (or a folder beneath it). Normally you would write it there and then have the device API move it. For example Prime31 lets you add it to the current camera roll on iOS.
and have android some like "Prime31" for moving the current screenshot to the gallery?
thanks
Yes you can find the documentation here - looks like saveImageToGallery
Thanks man this is nice, but i have to pay for downloading the plugins. Another way to take a function like that?