Created
June 15, 2016 14:58
-
-
Save tsubaki/f3f59b86535262fdef0c50790daa254d to your computer and use it in GitHub Desktop.
AnimationMixerPlayable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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