Hello everyone, I have a problem for which I cannot find a solution. I have several cameras on my stage, each camera films a character who makes a single animation. I want to record in a .mp4 file, for each camera, the animation of my character and that just with a script that I put in an Empty object. Let's imagine, I launch with the player button, for each camera, Unity launches a Recorder of twenty seconds, records in a .mp4 file, then activates another camera, relaunch the scene with a Recorder of 20 secs etc etc. How to drive the Unity Recorder by script ?
Hi Novakissime, You can create an empty game object, and associate it a MonoBehavior that sets up your recorders and starts recording on play. For example, you can setup a single recorder like so: Code (CSharp): var controllerSettings = ScriptableObject.CreateInstance<RecorderControllerSettings>(); m_RecorderController = new RecorderController(controllerSettings); var mediaOutputFolder = new DirectoryInfo(Path.Combine(Application.dataPath, "..", "SampleRecordings")); // Video m_SettingsCamera1 = ScriptableObject.CreateInstance<MovieRecorderSettings>(); m_SettingsCamera1.name = "Camera 1 Recorder"; m_SettingsCamera1.Enabled = true; // This example performs an MP4 recording m_SettingsCamera1.EncoderSettings = new CoreEncoderSettings { EncodingQuality = CoreEncoderSettings.VideoEncodingQuality.High, Codec = CoreEncoderSettings.OutputCodec.MP4 }; m_SettingsCamera1.CaptureAlpha = true; // Record from a specific camera m_SettingsCamera1.ImageInputSettings = new CameraInputSettings { OutputWidth = 320, OutputHeight = 240, Source = ImageSource.TaggedCamera, CameraTag = "Camera1" }; // Simple file name (no wildcards) so that FileInfo constructor works in OutputFile getter. m_SettingsCamera1.OutputFile = mediaOutputFolder.FullName + "/" + "video"; You can setup one setting for each character, and then start the recording like so: Code (CSharp): // Setup Recording controllerSettings.AddRecorderSettings(m_SettingsCamera1); controllerSettings.AddRecorderSettings(m_SettingsCamera2); //... controllerSettings.SetRecordModeToFrameInterval(0, 1119); // 20s @ 60 FPS controllerSettings.FrameRate = 60.0f; RecorderOptions.VerboseMode = false; m_RecorderController.PrepareRecording(); m_RecorderController.StartRecording(); For more information you can also look in the samples provided with the recorder package