I’ve successfully made code that will add in a blendtree with the animations at set intervals that dynamically change dependent on how many motions are added. Where my code falls down is that it generates a new blend tree everytime it is called, which is everytime I press play.
Is there a way to alter this so that it deletes itself or changes itself instead of generating a new one?
public class AnimationSwitcher : MonoBehaviour
{
public List<Motion> animations;
public AnimatorController animator;
private BlendTree blendTree;
void Start()
{
animator.CreateBlendTreeInController("Active", out blendTree);
addMotions();
}
public void addMotions()
{
int numberAnimations = animations.Count;
for (int i = 0; i < animations.Count; i++)
{
Debug.Log(i);
blendTree.AddChild(animations_, ((1 * i / numberAnimations)));_
}
}
}