public static AnimatorPlayable alloc(string p_graphName, Animator p_animator) { AnimatorPlayable l_instance = new AnimatorPlayable(); l_instance.Animator = p_animator; l_instance.GlobalPlayableGraph = PlayableGraph.Create(p_graphName); l_instance.GlobalPlayableGraph.SetTimeUpdateMode(DirectorUpdateMode.GameTime); var playableOutput = AnimationPlayableOutput.Create(l_instance.GlobalPlayableGraph, "Animation", p_animator); l_instance.AnimationLayerMixerPlayable = AnimationLayerMixerPlayable.Create(l_instance.GlobalPlayableGraph); PlayableOutputExtensions.SetSourcePlayable(playableOutput, l_instance.AnimationLayerMixerPlayable); l_instance.GlobalPlayableGraph.Play(); return(l_instance); }
public static void free(AnimatorPlayable p_animatorPlayable) { p_animatorPlayable.GlobalPlayableGraph.Destroy(); }
private void Awake() { AnimatorPlayable = AnimatorPlayable.alloc(gameObject.name, GetComponent <Animator>()); AnimatorPlayable.Play(); AnimatorPlayableComponentContainer.AnimatorPlayableComponents.Add(this); }