Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Get all GroupTrack In Timeline

Discussion in 'Timeline' started by Suika, Jan 11, 2018.

  1. Suika

    Suika

    Joined:
    Nov 19, 2013
    Posts:
    33
    Hi Guys

    Is there a way to Get all GroupTrack in Timeline ?

    The GetOutputTrack won't get GroupTrack.


    I really don't want to scan all OutputTrack and get their parent..

    Thx.

    圖片 41.png
     
  2. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    GetOutputTracks() is exactly the opposite of what you want. It only gets tracks that generate an actual 'output'. Output here references to a PlayableOutput in the playable system.

    Instead use GetRootTracks(). It gets the nested hierarchy, group tracks included.
     
    _slash_ likes this.
  3. Suika

    Suika

    Joined:
    Nov 19, 2013
    Posts:
    33
    I already get OutputTracks , but I need GroupTrack TOO


    Because Timeline have lot of problem in copy track and paste to another timeline. (see issue 979587, 959839, 974394 etc)

    And our project can't wait until the "future release" come out. So we make an timeline copy tool too avoid those issue.
    Without getting group track, the new timeline won't see like origin one.
     
  4. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    Using the API call TimelineAsset.GetRootTracks() on the timeline will get all tracks, the group tracks included.
     
  5. Suika

    Suika

    Joined:
    Nov 19, 2013
    Posts:
    33
    Thanks.
    I'll try that.
     
  6. Deleted User

    Deleted User

    Guest

    How to get sub-Group Track?? I I cant get it from outputs rootoutputs
     
  7. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    GetRootTracks() gives you the top most hierarchy. On a track, you can call GetChildTracks() to get the nested tracks. On a groupTrack, this will give you the list of tracks in a group. On an animation track, that will give you any additional layers (i.e. override tracks).

    GetOutputTracks() is a shorthand to get all the tracks that produce a playable output, i.e. basically everything except group and override tracks.

    GetRootTracks() / GetChildTracks() lets you walk the hierarchy of tracks as seen in the editor.