설명 없음
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.

TextTrack.cs 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #if TEXT_TRACK_REQUIRES_TEXTMESH_PRO
  2. using TMPro;
  3. using UnityEngine;
  4. using UnityEngine.Playables;
  5. using UnityEngine.Timeline;
  6. namespace Timeline.Samples
  7. {
  8. // A track that allows the user to change Text parameters from a Timeline.
  9. // It demonstrates the following
  10. // * How to support blending of timeline clips.
  11. // * How to change data over time on Components that is not supported by Animation.
  12. // * Putting properties into preview mode.
  13. // * Reacting to changes on the clip from the Timeline Editor.
  14. // Note: This track requires the TextMeshPro package to be installed in the project.
  15. [TrackColor(0.1394896f, 0.4411765f, 0.3413077f)]
  16. [TrackClipType(typeof(TextPlayableAsset))]
  17. [TrackBindingType(typeof(TMP_Text))]
  18. public class TextTrack : TrackAsset
  19. {
  20. // Creates a runtime instance of the track, represented by a PlayableBehaviour.
  21. // The runtime instance performs mixing on the timeline clips.
  22. public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
  23. {
  24. return ScriptPlayable<TextTrackMixerBehaviour>.Create(graph, inputCount);
  25. }
  26. // Invoked by the timeline editor to put properties into preview mode. This permits the timeline
  27. // to temporarily change fields for the purpose of previewing in EditMode.
  28. public override void GatherProperties(PlayableDirector director, IPropertyCollector driver)
  29. {
  30. TMP_Text trackBinding = director.GetGenericBinding(this) as TMP_Text;
  31. if (trackBinding == null)
  32. return;
  33. // The field names are the name of the backing serializable field. These can be found from the class source,
  34. // or from the unity scene file that contains an object of that type.
  35. driver.AddFromName<TMP_Text>(trackBinding.gameObject, "m_text");
  36. driver.AddFromName<TMP_Text>(trackBinding.gameObject, "m_fontSize");
  37. driver.AddFromName<TMP_Text>(trackBinding.gameObject, "m_fontColor");
  38. base.GatherProperties(director, driver);
  39. }
  40. }
  41. }
  42. #endif