您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
29 行
737 B
29 行
737 B
using UnityEngine;
|
|
using UnityEngine.Playables;
|
|
using UnityEngine.Timeline;
|
|
using Cinemachine;
|
|
|
|
public class BindCinemachineBrain : MonoBehaviour
|
|
{
|
|
private CinemachineBrain brain;
|
|
private PlayableDirector timeline;
|
|
|
|
// Use this for initialization
|
|
private void OnEnable()
|
|
{
|
|
brain = FindObjectOfType<CinemachineBrain>();
|
|
timeline = GetComponent<PlayableDirector>();
|
|
|
|
BindTimelineTracks();
|
|
}
|
|
|
|
public void BindTimelineTracks()
|
|
{
|
|
if (brain == null || timeline == null)
|
|
return;
|
|
var timelineAsset = (TimelineAsset)timeline.playableAsset;
|
|
|
|
var track = timelineAsset.GetOutputTrack(1);
|
|
timeline.SetGenericBinding(track, brain);
|
|
}
|
|
}
|