How do I store a path in a variable?

I am building a script to capture image sequences while I hold a key down (to output to QT for making videos). How do I store a path to a folder in a variable so the user can define where to save the images to?


var imageIncrement : int = 0;
var filePath : path;
var sequenceName = "Screenshot";

private var recordVideo : boolean = false;

   function Update () {
 checkForRecord ();
 if (recordVideo == true){
 Application.CaptureScreenshot(filePath + sequenceName + imageIncrement + ".png");
 imageIncrement += 1;
 recordVideo = false;

    function checkForRecord (){
if (Input.GetKey ("space")){
	recordVideo = true;
	print ("Recording...");

if (recordVideo == false){
	print ("Waiting...");
	imageIncrement = 0;

Incidentally, can I just make this into an Editor script? How would I do that? (Would be nice to have say a Record and Stop button to click)

If you just want the user to be able to enter the path as a string, make your filePath var a String type.

Since you're making an editor script, you could use this function to actually pop open a Dialog box where the user can select the path. This function returns a string (so your filePath var will stilll need to be typed as String): EditorUtility.OpenFilePanel