overrides | 接收结果的数组。 |
获取当前在此动画控制器中定义的动画剪辑覆盖列表。
如果您使用 AnimatorOverrideController.overridesCount 预先分配了 overrides 列表,则此函数无需分配内存。
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class ResetOverrides : MonoBehaviour { public AnimatorOverrideController overrideController; protected List<KeyValuePair<AnimationClip, AnimationClip>> overrides;
public void ResetAllOverrides() { overrides = new List<KeyValuePair<AnimationClip, AnimationClip>>(overrideController.overridesCount); overrideController.GetOverrides(overrides); for (int i = 0; i < overrides.Count; ++i) overrides[i] = new KeyValuePair<AnimationClip, AnimationClip>(overrides[i].Key, null); overrideController.ApplyOverrides(overrides); } }