Skip to content

Instantly share code, notes, and snippets.

@tsubaki
Created June 15, 2016 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsubaki/f3f59b86535262fdef0c50790daa254d to your computer and use it in GitHub Desktop.
Save tsubaki/f3f59b86535262fdef0c50790daa254d to your computer and use it in GitHub Desktop.
AnimationMixerPlayable
using UnityEngine;
using System.Collections;
using UnityEngine.Experimental.Director;
public class SamplePlayableAPI : MonoBehaviour {
// 対象のAniamtor
[SerializeField] Animator animator;
// 再生するAnimationClip
[SerializeField] AnimationClip run, walk;
private AnimationMixerPlayable mixer;
void Start ()
{
mixer = AnimationMixerPlayable.Create();
mixer.SetInputs(new [] { run, walk });
animator.Play(mixer);
Weight = 0;
}
public float Weight
{
set {
mixer.SetInputWeight(0, value);
mixer.SetInputWeight(1, 1 - value);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment