记录一下做Timeline的AudioSource过程
一、准备
导入Default Playables插件https://assetstore.unity.com/packages/essentials/default-playables-95266创建以AudioSource为资源的Timeline Playable
创建AudioSource资源,取消Play On Awake
在Behaviour中调整Play和Pause
二、外部调用
我这里用一个Button,控制clip之间距离:
public void ClickButton()
{
playableDirector = GetComponent<PlayableDirector>();
//开始的时候,储存所有轨道信息,轨道名称作为key,Track作为value,用于动态设置
foreach (var bind in playableDirector.playableAsset.outputs