Skip to content

Instantly share code, notes, and snippets.

@tsubaki
Last active March 8, 2022 01:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tsubaki/30416864f4438fe1603ca34d32238c26 to your computer and use it in GitHub Desktop.
Save tsubaki/30416864f4438fe1603ca34d32238c26 to your computer and use it in GitHub Desktop.
動的なバインド(ControlTrackのControlPlayableAsset)
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 ();
}
}
@tsubaki
Copy link
Author

tsubaki commented Dec 8, 2017

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