Version: 2020.2
public void GetOverrides (List<KeyValuePair<AnimationClip,AnimationClip>> overrides);

参数

overrides 用于接收结果的数组。

描述

获取该动画器重写控制器中当前定义的动画剪辑重写的列表。

如果使用 AnimatorOverrideController.overridesCount 预先分配重写列表,则该函数不执行任何分配。

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); } }