在Unity的timeline相关自定义代码编写中,有时候会需要在PlayableBehaviour
中获取TimeClip
的开始和结束时间,通过PlayableBehaviour
提供的接口我们会发现找不到对应的属性或者方法。
这篇回答中有详细解释:How to access the clip timing (start, end time) in PlayableBehaviour functions
这里附代码实现方式,需要在Track、Asset和Playable通过三次传递:
[TrackClipType(typeof(XXXControlAsset))]
public class XXXControlTrack : TrackAsset
{
public override Playable CreateTrackMixer(