Get AnimationClip Values from Script

I have an AnimaitonClip (_myAnimation) with this values:

How do I access them via script?

Why this doesn’t work?

var bind= AnimationUtility.GetAllCurves(_myAnimation);
string propertyName = "localEulerAngles";

  foreach (var VARIABLE in bind)
  {

  EditorCurveBinding xBind = EditorCurveBinding.FloatCurve(VARIABLE.path, typeof(Transform), propertyName + ".x");
  EditorCurveBinding yBind = EditorCurveBinding.FloatCurve(VARIABLE.path, typeof(Transform), propertyName + ".y");
  EditorCurveBinding zBind = EditorCurveBinding.FloatCurve(VARIABLE.path, typeof(Transform), propertyName + ".z");

  float x_value, y_value, z_value;

  AnimationUtility.GetFloatValue(this.gameObject, xBind, out x_value);
  AnimationUtility.GetFloatValue(this.gameObject, yBind, out y_value);
  AnimationUtility.GetFloatValue(this.gameObject, zBind, out z_value);

  }

x_value, y_value, z_value should be my values because GetFloatValues “Retrieves the current float value by sampling a curve value on a specific game object.”, however the values are from the current model rotation instead…

It’s because I can’t get the curves in runtime? (Accessing keyframes from an animation - Questions & Answers - Unity Discussions)
What are my alternatives to achieve this? Any ideias?

I have the same problem in 2018 :frowning:

Still no solution for this ?

1 Like

As far as I know, your only option is to extract the curve in the editor and serialize it separately.