【发布时间】:2020-09-02 10:03:58
【问题描述】:
我正在尝试制作一个脚本,该脚本将接收动画列表并自动将它们添加到混合树中。我查看了混合树 API 并想出了这个:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEditor.Animations;
public class AnimationSwitcher : MonoBehaviour
{
public List<Motion> animations;
public Animator animator;
public BlendTree blendTree;
public void addMotions()
{
for (int i = 0; i < animations.Count; i++)
{
blendTree.AddChild(animations[i]);
}
}
}
我知道我必须使用 animator 组件,但是对于如何使用它来添加 blendtree 子组件,我无法获得易于阅读的答案。我试过在编辑器中分配混合树,但也没有用
【问题讨论】:
标签: c# visual-studio unity3d animation