{"record":{"id":"ab808606777795eb","repo":"Unity-Technologies/UnityCsReference","slug":"cannot-save-to-clip-as-there-is-nothing-to-save-t","errorCode":null,"errorMessage":"Cannot save to clip as there is nothing to save. The method TakeSnapshot() has not been called.","messagePattern":"Cannot save to clip as there is nothing to save\\. The method TakeSnapshot\\(\\) has not been called\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"Editor/Mono/Animation/GameObjectRecorder.bindings.cs","lineNumber":102,"sourceCode":"        extern public EditorCurveBinding[] GetBindings();\n\n        // Recording.\n        extern public void TakeSnapshot(float dt);\n        extern public float currentTime { get; }\n        extern public bool isRecording { get; }\n\n        public void SaveToClip(AnimationClip clip)\n        {\n            SaveToClip(clip, 60.0f);\n        }\n\n        public void SaveToClip(AnimationClip clip, float fps)\n        {\n            if (fps <= Mathf.Epsilon)\n                throw new ArgumentException(\"FPS can't be 0.0 or less\");\n\n            if (!isRecording)\n                throw new InvalidOperationException(\"Cannot save to clip as there is nothing to save. The method TakeSnapshot() has not been called.\");\n\n            SaveToClipInternal(clip, fps, k_DefaultCurveFilterOptions);\n\n            AnimationUtility.onCurveWasModified?.Invoke(clip, new EditorCurveBinding(), AnimationUtility.CurveModifiedType.ClipModified);\n        }\n\n        public void SaveToClip(AnimationClip clip, float fps, CurveFilterOptions filterOptions)\n        {\n            if (fps <= Mathf.Epsilon)\n                throw new ArgumentException(\"FPS can't be 0.0 or less\");\n\n            if (filterOptions.keyframeReduction)\n            {\n                if (filterOptions.positionError < 0 || filterOptions.rotationError < 0 || filterOptions.scaleError < 0 || filterOptions.floatError < 0)\n                    throw new ArgumentException(\"Allowed errors for keyframe reduction cannot be negative.\");\n            }\n\n            if (!isRecording)","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/Animation/GameObjectRecorder.bindings.cs#L84-L120","documentation":"Thrown by GameObjectRecorder.SaveToClip(AnimationClip, float) when isRecording is false. The recorder only has data after TakeSnapshot has been called at least once; saving without snapshots would write an empty clip. The guard throws InvalidOperationException so the caller knows the recording session was never started.","triggerScenarios":"Constructing a GameObjectRecorder, binding, then immediately calling SaveToClip without any TakeSnapshot. Calling TakeSnapshot after isRecording was already reset by ResetRecording or clip finalization. A delayed/async flow where snapshots were skipped due to an early return.","commonSituations":"Automated clip-baking tools that gate snapshots on a condition that never became true. Editor scripts that bind and save in the same callback without the per-frame snapshot step. Recorder reused across clips without restarting recording.","solutions":["Ensure at least one TakeSnapshot(dt) call occurs between Bind and SaveToClip.","Check recorder.isRecording (or track a snapshot count) before saving.","For deterministic bakes, loop TakeSnapshot over the desired frame range before SaveToClip.","Call ResetRecording only after SaveToClip, not before."],"exampleFix":"// before\nrecorder.Bind(transform);\nrecorder.SaveToClip(clip, 60f);\n\n// after\nrecorder.Bind(transform);\nfor (int i = 0; i < frameCount; i++) recorder.TakeSnapshot(1f / 60f);\nrecorder.SaveToClip(clip, 60f);","handlingStrategy":"validation","validationCode":"if (!recorder.isRecording) { Debug.LogError(\"Recorder has no samples; call TakeSnapshot first.\"); return; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Call TakeSnapshot at least once between Bind and SaveToClip.","For deterministic bakes, loop TakeSnapshot over the frame range.","Call ResetRecording only after SaveToClip completes."],"tags":["animation","invalid-operation","gameobject-recorder","lifecycle","csharp"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}