Maze / Library /PackageCache /com.unity.timeline@1.6.5 /Samples~ /Customization /TimeDilation /TimeDilationPlayableAsset.cs
| using System; | |
| using UnityEngine; | |
| using UnityEngine.Playables; | |
| using UnityEngine.Timeline; | |
| namespace Timeline.Samples | |
| { | |
| // A clip for the timeline dilation track. | |
| [] | |
| public class TimeDilationPlayableAsset : PlayableAsset, ITimelineClipAsset | |
| { | |
| // Using a template for the playable behaviour will allow any serializable fields on the behaviour | |
| // to be animated. | |
| [] | |
| public TimeDilationBehaviour template = new TimeDilationBehaviour(); | |
| // Implementation of ITimelineClipAsset, that tells the timeline editor which | |
| // features this clip supports. | |
| public ClipCaps clipCaps | |
| { | |
| get { return ClipCaps.Extrapolation | ClipCaps.Blending; } | |
| } | |
| // Called to creates a runtime instance of the clip. | |
| public override Playable CreatePlayable(PlayableGraph graph, GameObject owner) | |
| { | |
| // Note that template is passed as a parameter - this | |
| // creates a clone of the template PlayableBehaviour. | |
| return ScriptPlayable<TimeDilationBehaviour>.Create(graph, template); | |
| } | |
| } | |
| } | |