Timeline - 获取所有轨道,轨道的片段信息

#

var timelineAsset = director.playableAsset as TimelineAsset;
foreach (PlayableBinding pb in timelineAsset.outputs)
{
    //pb.streamName--轨道名称
    //pb.sourceObject--轨道, 获取到轨道就可以获取ClipAsset
    //pb.outputTargetType--轨道绑定的类型, TrackBindingType

    Debug.Log("=====track");
    Debug.Log($"type:{pb.GetType().Name}, trackName:{pb.streamName}");

    if (null != pb.sourceObject)
    {
        TrackAsset trackAsset = pb.sourceObject as TrackAsset;
        foreach (TimelineClip clip in trackAsset.GetClips()) //轨道上的所有片段
        {
            //...
        }
    }
    if (null != pb.outputTargetType)
    {
        Debug.Log($"[TrackBindingType]: {pb.outputTargetType.Name}");
    }
}

 

posted @ 2023-01-06 19:44  yanghui01  阅读(482)  评论(0编辑  收藏  举报