Skip to content

Commit 609a15c

Browse files
ImageSequenceRecorder Output Subdirectory
1 parent eabcd9c commit 609a15c

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

Editor/ImageSequenceRecorder.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,17 @@ static RecorderController recorderController
2929
static public void StartRecording(string recordingName, int framerate = 30)
3030
{
3131
#if UNITY_EDITOR && RECORDER_AVAILABLE
32-
StopRecording();
32+
if (m_RecorderController != null && m_RecorderController.IsRecording())
33+
{
34+
Debug.Log($"Stopping {m_RecorderController.Settings.name}.");
35+
StopRecording();
36+
}
3337

3438
var mediaOutputFolder = Path.Combine(Application.dataPath, "..", "Recordings");
39+
mediaOutputFolder = Path.GetFullPath(Path.Combine(mediaOutputFolder, recordingName));
3540
// Image Sequence
3641
var imageRecorder = ScriptableObject.CreateInstance<ImageRecorderSettings>();
37-
imageRecorder.name = "ImageSequenceRecorder";
42+
imageRecorder.name = recordingName;
3843
imageRecorder.Enabled = true;
3944

4045
imageRecorder.OutputFormat = ImageRecorderSettings.ImageRecorderOutputFormat.PNG;
@@ -52,13 +57,16 @@ static public void StartRecording(string recordingName, int framerate = 30)
5257
};
5358

5459
// Setup Recording
60+
recorderController.Settings.name = recordingName;
5561
recorderController.Settings.FrameRate = framerate;
5662
recorderController.Settings.FrameRatePlayback = FrameRatePlayback.Constant;
5763
recorderController.Settings.CapFrameRate = true;
5864
recorderController.Settings.AddRecorderSettings(imageRecorder);
5965
recorderController.Settings.SetRecordModeToManual();
6066
RecorderOptions.VerboseMode = false;
61-
67+
68+
Debug.Log($"Starting Recording: {mediaOutputFolder}");
69+
6270
try
6371
{
6472
recorderController.PrepareRecording();
@@ -79,7 +87,6 @@ static public void StopRecording()
7987
if (m_RecorderController != null && m_RecorderController.IsRecording())
8088
{
8189
m_RecorderController.StopRecording();
82-
Destroy(m_RecorderController);
8390
m_RecorderController = null;
8491
}
8592
#endif

0 commit comments

Comments
 (0)