I use this code
public static string MakeScreenShot()
{
string directoryPath =Path.Combine(Application.persistentDataPath ,"Screenshots");
if(!Directory.Exists(directoryPath))
{
//if it doesn't exist, create it
Directory.CreateDirectory(directoryPath);
}
string fPath = Path.Combine(directoryPath,"LastPhoto.png");
ScreenCapture.CaptureScreenshot(fPath);
Debug.Log("Screenshot created " + fPath);
return fPath;
}
It works great in the editor, but on android device i got an error that this file can not be written. What’s wrong ?
<i>AndroidPlayer(ADB@127.0.0.1:34999)</i> Failed to store screen shot (/storage/emulated/0/Android/data/com.DefaultCompany.Test3D/files/storage/emulated/0/Android/data/com.DefaultCompany.Test3D/files/Screenshots/LastPhoto.png)