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

Timeline custom clip extrapolation

Discussion in 'Timeline' started by Wattosan, Feb 17, 2020.

  1. Wattosan

    Wattosan

    Joined:
    Mar 22, 2013
    Posts:
    456
    Hello,

    I followed the tutorial on this Unity's blog post and I created a custom clip with mixing. How would I add the extrapolate functionalities provided for default Animation tracks? I would like the last values to be retained.

    Should I buffer the last valid values (with weight above 0) and then use them when weight is 0?

    Thanks!
     
  2. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    If your playable asset implements ITimelineClip (which tells the editor the clips capabilities), specify ClipCaps.Extrapolate as one of the capabilities.

    When the playable behaviour is created, it will be set up as if the clip starts and ends at the beginning and end of the extrapolated region, instead of just the clips region.
     
  3. Wattosan

    Wattosan

    Joined:
    Mar 22, 2013
    Posts:
    456
    How do I specify the ClipCaps.Extrapolate?
     
  4. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    It's just a getter inside the PlayableAsset for your clip.

    Code (CSharp):
    1.     public class MyPlayableAsset : PlayableAsset, ITimelineClipAsset
    2.     {
    3.         public ClipCaps clipCaps
    4.         {
    5.             get
    6.             {
    7.                 return ClipCaps.ClipIn | ClipsCaps.Extrapolate | ClipsCaps.Looping;
    8.             }
    9.         }
    10.        
    11.         public override Playable CreatePlayable(PlayableGraph graph, GameObject go) ....
    12.