Unity3D自动创建动画控制器(AnimationOverrideController)

发表于2018-09-27
评论0 5.1k浏览
上一篇中给大家介绍了如何创建动画控制器(AnimationController),这一篇我们就来介绍下自动创建AnimationOverrideController,方法很简单,直接上代码,详细看了上一篇的这篇都看得懂。

using System.Collections;
using UnityEditor.Animations;
using UnityEngine;
using UnityEditor;
public class CreateAnimatorController : Editor {
    [MenuItem("Animator/Create Animator Override Controller")]
    static void CreateAnimatorOverrideController()
    {
        RuntimeAnimatorController animatorController = AssetDatabase.LoadAssetAtPath<AnimatorController> ("Assets/Animation/Motion.controller");
        var animatorOverrideController = new AnimatorOverrideController (animatorController);
        AssetDatabase.CreateAsset (animatorOverrideController, "Assets/Animation/OverrideMotion.anim");
        AssetDatabase.SaveAssets ();
    }
}

最终结果如图:

简单方便快捷,用起来不费劲。

如社区发表内容存在侵权行为,您可以点击这里查看侵权投诉指引