A game about forced loneliness, made by TACStudios
1using System;
2using UnityEngine;
3using UnityEngine.Playables;
4using UnityEngine.Timeline;
5
6namespace Timeline.Samples
7{
8 // Timeline track to play videos.
9 // This sample demonstrates the following
10 // * Using built in blending, speed and clip-in capabilities in custom clips.
11 // * Using ClipEditors to customize clip drawing.
12 // * Using a mixer PlayableBehaviour to perform look-ahead operations.
13 // * Managing UnityEngine.Object lifetime (VideoPlayer) with a PlayableBehaviour.
14 // * Using ExposedReferences to reference Components in the scene from a PlayableAsset.
15 [Serializable]
16 [TrackClipType(typeof(VideoPlayableAsset))]
17 [TrackColor(0.008f, 0.698f, 0.655f)]
18 public class VideoTrack : TrackAsset
19 {
20 // Called to create a PlayableBehaviour instance to represent the instance of the track, commonly referred
21 // to as a Mixer playable.
22 public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
23 {
24 // This is called immediately before CreatePlayable on VideoPlayableAsset.
25 // Each playable asset needs to be updated to the last clip values.
26 foreach (var clip in GetClips())
27 {
28 var asset = clip.asset as VideoPlayableAsset;
29 if (asset != null)
30 {
31 asset.clipInTime = clip.clipIn;
32 asset.startTime = clip.start;
33 }
34 }
35
36 return ScriptPlayable<VideoSchedulerPlayableBehaviour>.Create(graph, inputCount);
37 }
38 }
39}