Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    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 Customize-able nested track like control track

Discussion in 'Timeline' started by x4637x, Aug 22, 2020.

  1. x4637x

    x4637x

    Joined:
    May 9, 2017
    Posts:
    4
    I was digging information all day long about how to create a set of custom track/asset/behaviour that can use another type of custom track/asset/behaviour, as to how we could use Control track to control another timeline.

    My main objective is to make some subtitle for our animation, but need to sync audio & text colour rendering word by word. And there will be a lot of sentences as well.

    So I was thinking about making a custom track act as the sentence track, where it contains all the words as playable clips under its sub-track so we can do some detail adjustment to each word.

    My question is: can we use timeline like that?
     
  2. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    You can - but it requires you to use two different playable directors.

    To create your own subtimeline track, your custom track clip can have a ClipEditor that implements GetSubTimelines to return the nested timeline/playableDirector.

    For control tracks, it nests by having the user explicitly assign the playable director with the sub timeline, but you could change the workflow and auto-create what you need.

    Code (CSharp):
    1.     [CustomTimelineEditor(typeof(ControlPlayableAsset))]
    2.     class ControlPlayableAssetEditor : ClipEditor
    3.     {
    4.        
    5.         public override void GetSubTimelines(TimelineClip clip, PlayableDirector director, List<PlayableDirector> subTimelines)
    6.         {
    7.         ... // add the nested timeline to the subTimelines list
    8.         }
    9.     }