mathe/Library/PackageCache/com.unity.timeline@1.7.5/Samples~/Customization/Text/TextPlayableAsset.cs

34 lines
1.1 KiB
C#
Raw Normal View History

2024-09-20 20:30:10 +02:00
#if TEXT_TRACK_REQUIRES_TEXTMESH_PRO
using System;
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Timeline;
namespace Timeline.Samples
{
// Represents the serialized data for a clip on the TextTrack
[Serializable]
public class TextPlayableAsset : PlayableAsset, ITimelineClipAsset
{
[NoFoldOut]
[NotKeyable] // NotKeyable used to prevent Timeline from making fields available for animation.
public TextPlayableBehaviour template = new TextPlayableBehaviour();
// Implementation of ITimelineClipAsset. This specifies the capabilities of this timeline clip inside the editor.
public ClipCaps clipCaps
{
get { return ClipCaps.Blending; }
}
// Creates the playable that represents the instance of this clip.
public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
{
// Using a template will clone the serialized values
return ScriptPlayable<TextPlayableBehaviour>.Create(graph, template);
}
}
}
#endif