1
私はスクリーンショットを取ってアンドロイドのデフォルトDCIMパスに保存するコードを書こうとしています。UNITY C#スクリーンショットの問題
public class IS_Screenshot : MonoBehaviour
{
string ScreenShotFile;
void Start()
{
ScreenShotFile = Application.persistentDataPath + "_Screenshot_" + System.DateTime.Now.ToString("_yyyy-MM-dd_HH-mm-ss") + ".png";
Debug.Log (ScreenShotFile);
}
public void Screen_Shot()
{
try
{
Application.CaptureScreenshot(ScreenShotFile);
string Path = "/mnt/sdcard/DCIM/" + "_Screenshot_" + System.DateTime.Now.ToString("_yyyy-MM-dd_HH-mm-ss_") + ".png";
Debug.Log (Path);
if(System.IO.File.Exists(ScreenShotFile))
{
System.IO.File.Move(ScreenShotFile, Path);
Debug.Log ("Screenshot file saved.");
}
else
{
Debug.Log ("Screenshot file not found.");
}
}
catch(Exception ex)
{
Debug.Log ("Screenshot capture failed. | " + ex);
}
}
}
:エラーが発生しますか?または単に「Screenshot file not found」と表示されますか? – TeunissenStefan
エラーはありません。ファイルは見つかりません。 –
このフォルダに保存されているユニティエディタの実行モードファイルは、「C:\ Users \ Seven \ AppData \ LocalLow \ ITCO」です。しかし、アンドロイドで私はそれらを見つけることができませんでした。 –