返回当前存储在剪辑中的所有浮点曲线绑定。
回答以下问题:“哪些浮点属性由剪辑进行动画化?”
Unity 具有两种类型的动画:浮点和对象引用。浮点曲线是一种随着时间的推移对浮点属性进行动画化的经典曲线。对象引用“曲线”是一种随着时间的推移对对象引用属性进行动画化的构造。
此方法仅返回浮点曲线绑定。请参阅 AnimationUtility.GetObjectReferenceCurveBindings 以了解对象引用曲线。
using UnityEditor;
using UnityEngine;
// Editor window for listing all float curves in an animation clip
public class ClipInfo : EditorWindow
{
private AnimationClip clip;
[MenuItem("Window/Clip Info")]
static void Init()
{
GetWindow(typeof(ClipInfo));
}
public void OnGUI()
{
clip = EditorGUILayout.ObjectField("Clip", clip, typeof(AnimationClip), false) as AnimationClip;
EditorGUILayout.LabelField("Curves:");
if (clip != null)
{
foreach (var binding in AnimationUtility.GetCurveBindings(clip))
{
AnimationCurve curve = AnimationUtility.GetEditorCurve(clip, binding);
EditorGUILayout.LabelField(binding.path + "/" + binding.propertyName + ", Keys: " + curve.keys.Length);
}
}
}
}