{"record":{"id":"16d2f40a7cdf5821","repo":"Unity-Technologies/UnityCsReference","slug":"posecurve-0-rotationcurve-1-heightcurve","errorCode":null,"errorMessage":"poseCurve '{0}', rotationCurve '{1}', heightCurve '{2}' and positionCurve '{3}' Length must be equals.","messagePattern":"poseCurve '(.+?)', rotationCurve '(.+?)', heightCurve '(.+?)' and positionCurve '(.+?)' Length must be equals\\.","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"Editor/Mono/MuscleClipUtility.bindings.cs","lineNumber":47,"sourceCode":"    internal struct QualityCurvesTime\n    {\n        public float fixedTime;\n        public float variableEndStart;\n        public float variableEndEnd;\n        public int q;\n    }\n\n    [NativeHeader(\"Editor/Src/Animation/MuscleClipQualityInfo.h\")]\n    internal class MuscleClipUtility\n    {\n        [FreeFunction]\n        extern internal static MuscleClipQualityInfo GetMuscleClipQualityInfo([NotNull] AnimationClip clip, float startTime, float stopTime);\n\n        internal static void CalculateQualityCurves(AnimationClip clip, QualityCurvesTime time, Vector2[] poseCurve, Vector2[] rotationCurve, Vector2[] heightCurve, Vector2[] positionCurve)\n        {\n            if (poseCurve.Length != rotationCurve.Length || rotationCurve.Length != heightCurve.Length || heightCurve.Length != positionCurve.Length)\n            {\n                throw new ArgumentException(string.Format(\n                    \"poseCurve '{0}', rotationCurve '{1}', heightCurve '{2}' and positionCurve '{3}' Length must be equals.\",\n                    poseCurve.Length, rotationCurve.Length, heightCurve.Length, positionCurve.Length));\n            }\n\n            CalculateQualityCurves(clip, time.fixedTime, time.variableEndStart, time.variableEndEnd, time.q, poseCurve, rotationCurve, heightCurve, positionCurve);\n        }\n\n        [FreeFunction]\n        extern protected static void CalculateQualityCurves([NotNull] AnimationClip clip, float fixedTime, float variableEndStart, float variableEndEnd, int q, [Out] Vector2[] poseCurve, [Out] Vector2[] rotationCurve, [Out] Vector2[] heightCurve, [Out] Vector2[] positionCurve);\n    }\n}\n","sourceCodeStart":29,"sourceCodeEnd":59,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/MuscleClipUtility.bindings.cs#L29-L59","documentation":"Thrown by MuscleClipUtility.CalculateQualityCurves when the four quality-curve arrays (poseCurve, rotationCurve, heightCurve, positionCurve) do not all share the same Length. The native call expects equally-sized output buffers.","triggerScenarios":"Calling CalculateQualityCurves with arrays of differing lengths, e.g., poseCurve.Length != rotationCurve.Length.","commonSituations":"Caller allocates the four arrays from different sources or with different sampling counts. Reusing partially-filled buffers. Off-by-one when computing required length from QualityCurvesTime.","solutions":["Allocate all four arrays to the same length before calling.","Derive the length from a single source (e.g., the sampling resolution) and reuse it for all allocations.","Add a precondition assert comparing the four lengths."],"exampleFix":"// before\nvar pose = new Vector2[n];\nvar rot = new Vector2[n + 1]; // mismatch\n// after\nint n = samples;\nvar pose = new Vector2[n];\nvar rot = new Vector2[n];\nvar height = new Vector2[n];\nvar position = new Vector2[n];\nMuscleClipUtility.CalculateQualityCurves(clip, time, pose, rot, height, position);","handlingStrategy":"validation","validationCode":"bool EqualLen(Vector2[] a, Vector2[] b, Vector2[] c, Vector2[] d) =>\n    a.Length == b.Length && b.Length == c.Length && c.Length == d.Length;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Allocate all four arrays from a single length source.","Assert lengths match before the native call."],"tags":["unity","animation","muscle-clip","validation"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}