Unable to capture screenshot

I’m trying to use Application.CaptureScreenshot to capture a screen shot. However, no matter what I try, I always get the error “Failed to store screen shot”. I have no idea why, and none of this, this, or this helped answer my question. I don’t need this to be fantastic code that will ship, this is just for capturing images for promotional purposes. Here is my code:

public class ScreenshotCreator : MonoBehaviour
    public KeyCode captureKey = KeyCode.Backspace;

    void Update()
        if (Input.GetKeyDown(captureKey))
            string now = DateTime.Now.ToString();
            now = now.Replace("/", "-");
            now = now.Replace(" ", "_");
            string file = string.Format("Screenshot__{0}.png", now);
            print(string.Format("Saved screenshot: {0}", file));

var nameScreenshot = “Screenshot_” + DateTime.Now.ToString(“dd-mm-yyyy-hh-mm-ss”) + “.png”;


Try this