30 lines
949 B
C#
30 lines
949 B
C#
using SRF;
|
|
using UnityEngine;
|
|
using UnityEngine.Playables;
|
|
using UnityEngine.Timeline;
|
|
|
|
[TrackClipType(typeof(InstantiateClip))]
|
|
public class InstantiatTrack : TrackAsset
|
|
{
|
|
/// <summary>
|
|
/// 道具路径
|
|
/// </summary>
|
|
public string Path;
|
|
/// <summary>
|
|
/// 要赋值的轨道名
|
|
/// </summary>
|
|
public string TrackName;
|
|
|
|
public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
|
|
{
|
|
ScriptPlayable<InstantiatePlayable> playable = ScriptPlayable<InstantiatePlayable>.Create(graph, inputCount);
|
|
|
|
InstantiatePlayable instantiateMixer = playable.GetBehaviour();
|
|
instantiateMixer.ItemPath = Path;
|
|
instantiateMixer.TrackName = TrackName;
|
|
instantiateMixer.PlayableDirector = go.GetComponent<PlayableDirector>();
|
|
instantiateMixer.ShowTimelineController = go.GetComponentOrAdd<ShowTimelineController>();
|
|
|
|
return playable;
|
|
}
|
|
} |