No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

VideoTrack.cs 1.6KB

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