我需要设置使用UNITY的Android和IOS应用程序保存图片的路径

Fer*_*ral 5 android screenshot image path unity-game-engine

我的实际代码:

function Update() { 
    if(Input.GetMouseButtonDown(0)) {
       Debug.Log("foto");
       Application.CaptureScreenshot(Application.dataPath + "Screenshot.png");
    }
}
Run Code Online (Sandbox Code Playgroud)

我需要为此功能输出每张照片的路径.

谢谢!

ddk*_*ddk 1

您可以将文件保存到Application.persistentDataPath。Unity 应用程序在 Android 或 iOS 设备上没有写入权限Application.dataPath

另外,不要忘记用正斜杠连接路径和文件夹名称:

Application.CaptureScreenshot(Application.persistentDataPath + "/Screenshot.png");
Run Code Online (Sandbox Code Playgroud)