Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Is there a way to create clips with default easing settings?

Discussion in 'Timeline' started by jeango, Sep 27, 2020.

  1. jeango

    jeango

    Joined:
    Dec 19, 2012
    Posts:
    109
    Hi, I made a custom clip for my subtitles, and I'd like all my subtitles to have 0.2 ease in and ease out time.
    Right now I have to set this by hand every time I create a new clip, is there a way to access and set that property by default when I create the clip?
     
  2. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    There is. One way to use a clip editor, which will get called when a clip is created in the timeline editor. Here's an example:

    Code (CSharp):
    1. [UnityEditor.Timeline.CustomTimelineEditor(typeof(MyPlayableAsset))]
    2. public class MyPlayableAssetClipEditor : UnityEditor.Timeline.ClipEditor
    3. {
    4.     public override void OnCreate(TimelineClip clip, TrackAsset track, TimelineClip clonedFrom)
    5.     {
    6.         if (clonedFrom == null)
    7.         {
    8.             clip.easeInDuration = 0.2;
    9.             clip.easeOutDuration = 0.2;
    10.         }
    11.     }
    12.  
     
    cdr9042 and jeango like this.