Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I need to set the path for saving the pictures with an application for Android and IOS with UNITY

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!

like image 326
Fernando Moral Avatar asked Nov 14 '22 01:11

Fernando Moral


1 Answers

You can save files to Application.persistentDataPath. Unity apps do not have write permissions to Application.dataPath on Android or iOS devices.

Also, don't forget to join the path and the folder name with a forward slash:

Application.CaptureScreenshot(Application.persistentDataPath + "/Screenshot.png");
like image 103
ddk Avatar answered Mar 24 '23 01:03

ddk