Please forgive any noob mistakes in the code – I’m not at all familiar with C#
The code below should take a screenshot on the device and then save to the device’s photos. It seems to get stuck saving the photo.
Any ideas where I’m going wrong?
IEnumerator MyMethod() {
yield return new WaitForSeconds(2);
var pathToImage = Application.persistentDataPath + "/" + saveToDiskScript.screenshotFilename;
var bytes = System.IO.File.ReadAllBytes( pathToImage );
System.IO.File.WriteAllBytes("private/var/root/Media/DCIM/100APPLE/" + screenshotFilename, bytes);
}
public void TakeSnapshot()
{
Application.CaptureScreenshot( screenshotFilename );
print ("Taking, " + screenshotFilename);
StartCoroutine(MyMethod());
}
The error I receive, in XCode: [Edited – I made the WaitForSeconds 5 instead of 2, and now I get this error – an improvement than before!]
IsolatedStorageException: Could not find a part of the path “/private/var/root/Media/DCIM/100APPLE/SomethingToThinkAbout03-05-201306:59:38.png”.
The debug log does show: SomethingToThinkAbout03-05-201306:59:38.png as the file name.