using RenderHeads.Media.AVProMovieCapture; using SFB; using System.IO; using UnityEngine; namespace AZTECHWB.Wrapper { public class CaptureRecoder { private CaptureBase capture; public void Setup() { capture = GameObject.FindFirstObjectByType(); capture.CameraRenderResolution = CaptureBase.Resolution.Custom; capture.CompletedFileWritingAction += OnCaptureCompleted; } public void SetRecordStatus(bool isStart) { if (isStart) { capture.StartCapture(); } else { capture.StopCapture(); } } private void OnCaptureCompleted(FileWritingHandler handler) { var sourcePath = handler.FinalPath; var destFilePath = StandaloneFileBrowser.SaveFilePanel("Save File", "", "", "mp4"); if (!string.IsNullOrEmpty(destFilePath)) { if (File.Exists(destFilePath)) File.Delete(destFilePath); File.Move(sourcePath, destFilePath); } else { File.Delete(sourcePath); } } } }