using DaCruz.ScreenshotKit;using UnityEngine;public class SequenceController : MonoBehaviour{ public Camera cam; void StartCapture() { var seq = new SequenceRecorder.RecordingSettings { SourceCamera = cam, OutputFolder = Application.dataPath + "/../Captures/MyShot", FilePrefix = "shot", FrameRate = 30, Resolution = SequenceRecorder.Resolution.Full, MaxDuration = 5f, Format = SequenceRecorder.ImageFormat.PNG, TransparentBackground = false, RenderMattes = false, }; SequenceRecorder.Instance.StartRecording(seq); } void StopCapture() { SequenceRecorder.Instance.StopRecording(); // finishes pending writes // or: SequenceRecorder.Instance.CancelRecording(); }}
The output is a folder of shot_000000.png, shot_000001.png, and so on. With RenderMattes = true, each enabled matte pass writes into its own subfolder per frame.
To capture individual frames yourself (no automatic loop), call ScreenshotCapture.CaptureSequenceFrame per frame. It returns a Texture2D you encode and save however you like. CaptureSequenceFrameWithMattes adds matte passes per frame into subfolders.
SequenceRecorder refuses to start outside Play Mode. Per-frame matte rendering is heavy; prefer capturing without mattes when performance matters.