Create a gist now

Instantly share code, notes, and snippets.

@tsubaki /Rebind.cs
Last active Sep 22, 2017

What would you like to do?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Playables;
using System.Linq;
using UnityEngine.Timeline;
using UnityEngine.Assertions;
public class Rebind : MonoBehaviour
public void Play (Rotation rotation)
var director = GetComponent<PlayableDirector> ();
var track = (ControlTrack)director.playableAsset.outputs.First (c => c.streamName == "Control Track").sourceObject;
var clip = (ControlPlayableAsset)track.GetClips ().First (c => c.displayName == "ControlPlayableAsset").asset ;
var exposeName = clip.sourceGameObject.exposedName;
director.SetReferenceValue (exposeName, rotation.gameObject);
director.Play ();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment