Recorder clips added to the timeline by script in edit mode are reset in play mode

Hi, I have a script to add a recorder track to the timeline and fill it with some recorder clips (all done in edit mode).
The script configures each clip, setting the timings, capture settings and output settings.
Everything is generated as expected by the script, but when entering play mode some of the settings are reset to defaults. This does not happen for clips that I make manually without the script.

Could it be a problem with the way I am configuring the clips in my script? Any help appreciated, thanks!

This is how I’m configuring the clips. The generic clip properties are retained, but the animation recorder specific settings are not.

    TimelineAsset ta = (TimelineAsset)playableDirector.playableAsset;
    RecorderTrack rt = ta.CreateTrack<RecorderTrack>("new track");
    
    // These settings are retained
    TimelineClip newClip = rt.CreateClip<RecorderClip>();
    newClip.displayName = "new clip";
    newClip.duration = 5;
    newClip.start = 0;
    
    RecorderClip rc = (RecorderClip)newClip.asset;
    // These settings are NOT retained
    rc.settings = ScriptableObject.CreateInstance<UnityEditor.Recorder.AnimationRecorderSettings>();
    var animSettings = rc.settings as UnityEditor.Recorder.AnimationRecorderSettings;
    animSettings.AnimationInputSettings.Recursive = true;
    animSettings.AnimationInputSettings.ClampedTangents = true;
    animSettings.AnimationInputSettings.SimplyCurves = 0;
    animSettings.AnimationInputSettings.AddComponentToRecord(typeof(Transform));
    animSettings.AnimationInputSettings.AddComponentToRecord(typeof(Camera));       
    animSettings.AnimationInputSettings.gameObject = animatedObject;
    
    rc.settings.Take = 1;
    rc.settings.FileNameGenerator.ForceAssetsFolder = true;
    rc.settings.FileNameGenerator.FileName = "new_shot";

After checking the code from the Recorder package, I’ve fixed my problem by adding these lines after the above:

AssetDatabase.AddObjectToAsset(rc.settings, rc);
AssetDatabase.SaveAssets();
2 Likes

Glad you figured it out!