String.Format won't work on Android.

Hi, I was just wondering what could be preventing this to work on Android Devices.
It takes the screenshot on PC inside the editor, but not on mobile.

The commented out line works fine on android.

Also the folder is created in the mobile environment but the screenshots are not saved there.

Is it wrong syntax for mobile?

Thanks, Tim.

 import System.IO;
 import System.Collections;
        var folder = "";
        var frameRate = 0;
        function Start () {
            Time.captureFramerate = frameRate;
            TakeScreenShot ();
        function Awake (){
        folder = Application.persistentDataPath + "/../../../../DCIM/TestShots/";

        function TakeScreenShot (){
        var info3 = new DirectoryInfo(folder);
        var fileInfo3 = info3.GetFiles();
        var name = String.Format("{0}/{1:D04} shot.png", folder, Time.frameCount );

    //        Application.CaptureScreenshot("Shot"+info3.GetFiles().Length +".png");

EDIT: I have this now, it will take and save in the correct location but now it gives the error, so the above question doesn’t really matter

“FormatException: The specified format ‘D04’ is invalid”

So I changed the D04 to 004 and it only takes one screenshot.

 var name = String.Format("{0}/{1:D04} shot.png", folder, frameRate );

How could I change this

to incorporate this part? As this would solve my problems.

var info3 = new DirectoryInfo(folder);
var fileInfo3 = info3.GetFiles();
 Application.CaptureScreenshot("Shot"+info3.GetFiles().Length +".png");

wrong format specification? Should it be “D4”, meaning four decimal places from the right side.

From Standard Numeric Format String on MSDN:

The “D” (or decimal) format specifier converts a number to a string of decimal digits (0-9), prefixed by a minus sign if the number is negative. This format is supported only for integral types.
The precision specifier indicates the minimum number of digits desired in the resulting string. If required, the number is padded with zeros to its left to produce the number of digits given by the precision specifier. If no precision specifier is specified, the default is the minimum value required to represent the integer without leading zeros.

Also see:

Composite Formatting

Edit: Hrm, may be another issue, ran it in VS2013 and mimic’d your code and it worked fine with leading zeros on the format specifier… :frowning: