Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Animations;
public class SimpleAnimation : MonoBehaviour {
PlayableGraph graph;
[SerializeField] string clipName = "RobotBoyRun";
void Awake()
graph = PlayableGraph.Create ();
void Start()
// アニメーションをResourcesから取得し
// AnimationClipPlayableを構築
var clip = Resources.Load<AnimationClip> (clipName);
var clipPlayable = AnimationClipPlayable.Create (graph, clip);
// outputを生成して、出力先を自身のAnimatorに設定
var output = AnimationPlayableOutput.Create (graph, "output", GetComponent<Animator>());
// playableをoutputに流し込む
output.SetSourcePlayable (clipPlayable);
graph.Play ();
void OnDestroy()
graph.Destroy ();

This comment has been minimized.

Copy link
Owner Author

tsubaki commented Jul 29, 2017

animation 96

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.