从Animator中获得runtimeAnimatorController.
RuntimeAnimatorController是运行时动画的Controller,可以用来在运行时改变源动画。
AnimatorOverrideController用来override animationClip的
参见AnimatorOverrideController api demo:
Animator animator = GetComponent<Animator>();AnimatorOverrideController overrideController = new AnimatorOverrideController();animator.runtimeAnimatorController = overrideController;初始化AnimatorOverrideController可以赋值给它一个runtimeAnimatorController
AnimatorOverrideController 的clips成员变量提供给获得AnimationClip接口
所以获得Clips的操作为:
Animator animator=GetComponent<Animator>();
AnimatorOverrideController overrideController=new AnimatorOverrideController ();
overrideController.runtimeAnimatorController=animator.runtimeAnimatorController;
AnimationClipPair[] pairclips=overrideController.clips;
AnimationClipPair中的originalClip和overrideClip分别为AnimationClip类型。前者是原始的动画资源,后者是可以覆盖的动画资源。