Search Unity

Question Adding Alembic Track and Clip to Timeline via script

Discussion in 'Scripting' started by RoughSpaghetti3211, Mar 31, 2022.

  1. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,709
    wondering if someone can help me, I'm stuck trying to add an alembic clip to my timeline via script. The the track just not sure how to add the clip?

    PlayableDirector director = GameObject.Find("TimeLine").GetComponent<PlayableDirector>();
    TimelineAsset timelineAsset = director.playableAsset as TimelineAsset;
    var newTrack = timelineAsset.CreateTrack<AlembicTrack> (null, "AlembicTrack Track ");
     
  2. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,709
    What am i missing here ?
    Code (CSharp):
    1.         PlayableDirector playableDirector =  GameObject.Find("TimeLine").GetComponent<PlayableDirector>();
    2.         playableDirector.playableAsset = timeline;
    3.         foreach (TrackAsset track in timeline.GetOutputTracks())
    4.         {
    5.             if(track.name == "Alembic Track")
    6.             {
    7.                 Debug.Log(track.name);
    8.                 playableDirector.SetGenericBinding(track, AbcGameObject);
    9.             }
    10.         }