Skip to content

Instantly share code, notes, and snippets.

@tsubaki
Created July 30, 2017 04:42
Show Gist options
  • Save tsubaki/3d2f885661bf3b8fce87c850e534b532 to your computer and use it in GitHub Desktop.
Save tsubaki/3d2f885661bf3b8fce87c850e534b532 to your computer and use it in GitHub Desktop.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Animations;
public class Jump : MonoBehaviour {
PlayableGraph graph;
[SerializeField] Animator animator = null;
[SerializeField] AnimationClip clip = null;
void Awake()
{
graph = animator.playableGraph;
}
void Start()
{
var clipPlayable = AnimationClipPlayable.Create (graph, clip);
var output = graph.GetOutput (0);
var layer = AnimationLayerMixerPlayable.Create (graph, 1);
layer.ConnectInput (0, clipPlayable, 0);
layer.SetLayerAdditive (0, true);
layer.SetInputWeight (0, 1);
output.SetSourcePlayable (layer);
graph.Play ();
}
void OnDestroy()
{
graph.Destroy ();
}
}
@tsubaki
Copy link
Author

tsubaki commented Jul 30, 2017

animation 107

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment