x


I need help converting a script to run in the Editor

@MenuItem ("Edit/Capture Video")

static function Apply() {

var filePath : String = EditorUtility.OpenFilePanel("Select a record path","","");
//Display dialog with Record and Cancel button
//if Record button is clicked, set recordVideo to true 
}

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

private var recordVideo : boolean = false;

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

function checkForRecord (){
if (Input.GetKey ("space")){
	recordVideo = false;
	print ("Recording Stopped");
            imageIncrement = 0;
		}
}

First, will this work? How would I say display a dialog with a button to click to start recording (and a cancel button). Would pressing the spacebar after that point cancel recording? And, most importantly, when the file dialog opens up, it won't let me choose a folder! Dialog with greyed out button

more ▼

asked Nov 18 '09 at 06:23 PM

noradninja gravatar image

noradninja
790 17 23 41

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

If you want the user to be able to select a folder, you should use EditorUtility.SaveFolderPanel(...).

more ▼

answered Nov 18 '09 at 08:25 PM

Ehren gravatar image

Ehren
4.2k 34 43 77

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x348

asked: Nov 18 '09 at 06:23 PM

Seen: 854 times

Last Updated: Nov 20 '09 at 12:55 PM