Last active
March 8, 2022 01:23
-
-
Save tsubaki/30416864f4438fe1603ca34d32238c26 to your computer and use it in GitHub Desktop.
動的なバインド(ControlTrackのControlPlayableAsset)
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 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
https://gist.github.com/tsubaki/30416864f4438fe1603ca34d32238c26/c8f94ef4bf9843ba0f3879ec162b2262437f1d70 2017.1とかはこちらかも