Create a gist now

Instantly share code, notes, and snippets.

Embed
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

This comment has been minimized.

Show comment
Hide comment
Owner

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