Created
July 30, 2017 04:42
-
-
Save tsubaki/3d2f885661bf3b8fce87c850e534b532 to your computer and use it in GitHub Desktop.
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 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 (); | |
} | |
} |
Author
tsubaki
commented
Jul 30, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment