- Home /
Screenshots Not Working Saving
When I compile my game (on PC), it makes the Screenshot folder but it doesn't save anything in it. Here's the code snippits:
var screenshotFolder = "Screenshots";
private var screenshotcount = 0;
if (Input.GetKey (KeyCode.F12))
{
Screenshot ();
}
function Screenshot() {
screenshotcount++;
var scrshot = String.Format("{0}/{1}screenshot.png", screenshotFolder, screenshotcount );
Application.CaptureScreenshot (scrshot);
yield WaitForSeconds(0.5);
}
function Start () {
if (System.IO.Directory.Exists(screenshotFolder)) {
} else {
System.IO.Directory.CreateDirectory(screenshotFolder);
}
}
When I launch it through Development Build, it says 'Failed to Store Screenshot'.
1.png
(37.3 kB)
Comment
Best Answer
Answer by Nakor · Jan 05, 2014 at 09:51 PM
private static string persistentDataPath = null;
public void Start()
{
if (persistentDataPath == null)
persistentDataPath = Application.persistentDataPath;
Debug.Log("Data Path = " + persistentDataPath); // If you want to easily see where that is.
}
Try using the persistent data path.
No problem. If my answer worked could you mark it as the answer? Thanks :)