// if you want screenshots set it to true
var autoScreenShot : boolean = false;

// the time between shots 
var shootTime : float = 1.5;

// the current amounf of time
private var currentTime : float = 0;

// and the current count of captured shots
private var screenshotcount = 0;

// the prefix to add to the front of the file name
var namePrefix : String;




function Update() {

	if(autoScreenShot){
		
		currentTime += Time.deltaTime;
		
		if(currentTime >= shootTime){
			
			// making the string for the file name. Only weird bit here is padding the frame count with 0's. eg 15 becomes 00015 
			var s : String = namePrefix + "_" + Application.loadedLevelName + "_" + pad(screenshotcount, 5) + ".png";
			
			// click
		    Application.CaptureScreenshot(s);
		   
		   	// let you know
		    print("file " + s + " saved");
		   
		   	// get ready for the next frame
		    screenshotcount++;
		    
		    currentTime = 0;
		}
	}	
}


function pad(n : int, padAmount : int): String {
   
    var s : String = n.ToString();

	while(s.length < padAmount){
		s = "0" + s;
	}
	
    return s;
}