Application.CaptureScreenshot() Fails on PC/Mac

I have an app with a screenshot button which calls Application.CaptureScreenshot(), with an oversize of 4. It works fine within the editor but in my builds no screenshot file is created. The app pauses while taking a screen (so I know the code is still called), but no file appears to be created anywhere that I can locate.

I’ve tried simply providing a filename itself (which in the editor causes the file to be created in the project root folder), and appending Application.persistentDataPath (which in the editor causes the file to be created in the same place as all other save data). In neither case does any file appear when running a build.

Unity 5.1.1, Windows and Mac.

Anyone have any ideas on this?

Hi Jason. I am running Unity 5.1.2p1 and if I use this code, Unity saves the screenshot on the project folder.

Application.CaptureScreenshot("ScreenshotNEW.png" , 4);

PersistentDataPath is a directory path where data expected to be kept between runs can be stored

dataPath contains the path to the game data folder

Could you try CaptureScreenshot function only using the name of the screenshot and tell me which version of Unity are you running?

@Jordi Bonastre @Jason RT Bond
Try This Guys
Here is simple Code for capturing screen shot, and showing the captured image on screen
This Code is For Andriod and IPhone.For PC Just Give the Image Path

 public RawImage image;
 void Start()
 public void Photo()
 public void GetPhoto()
         #if !UNITY_EDITOR
         string url = Application.persistentDataPath +"/"+Variables.ImageName;
         var bytes = File.ReadAllBytes( url );
         Texture2D texture = new Texture2D( 73, 73 );
         texture.LoadImage( bytes );
         image.texture= texture ;