Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

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.