- Home /
Add a blend tree child in script
I'm trying to make a script that will take in a list of animations and a blend tree and add the animations to the blend tree. But Unity doesn't recognise the Blend Tree namespace, but I don't know how else I would access the blend tree. I have a feeling I'll need to go through the animator, but if anyone can point me in a better way, I'd appreciate it.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class AnimationSwitcher : MonoBehaviour
{
public List<Motion> animations;
public BlendTree blendTree;
public void addMotions()
{
for (int i = 0; i < animations.Count; i++)
{
blendTree.AddChild(animations[i]);
}
}
}
Answer by ShadyProductions · Sep 02, 2020 at 09:52 AM
Hi, take a look here http://answers.unity.com/answers/1733416/view.html This should hopefully answer your question, some searching before posting a question get's you a long way.
Your answer
Follow this Question
Related Questions
How to sort motion clip list in Animation Window ? 0 Answers
Animation doesn't play when set to non-looping 2D 0 Answers
How to Change the Motion of an Animation State in an Animator Controller at Run-Time? 1 Answer
Animation blend tree value glitching after reaching zero 2 Answers
Wing animation 1 Answer