Hi,
I have some scenes that are being loaded through a Master Timeline (I created a custom Track, PlayableAsset and PlayableBehaviour). These scenes have a sub-timeline that i am also loading in the aforementioned Master Timeline, using a ControlTrack.
I wonder how can I get a reference to the ControlTrack (or the clip on this track) that contains my sub-timeline. I am currently taking it by it´s name (code below) but ideally i would like to make a public ControlTrack property on my PlayableBehaviour that loads the scenes so it has a reference to its own timeline… although it seems impossible to drag & drop a clip or track from the Timeline to a reference slot!
TimelineAsset playable = mainPlayableDirector.playableAsset as TimelineAsset;
// Look for the Control Track of the loaded scene.
foreach (PlayableBinding binding in playable.outputs)
{
if(binding.sourceObject)
{
if (binding.sourceObject.GetType() == typeof(ControlTrack))
{
ControlTrack tmpControlTrack = (ControlTrack)binding.sourceObject;
// If our Control Track exists, assign the TIMELINE object to all its clips if (tmpControlTrack.name == "TIMELINE " + scene.name)
{
controlTrack = tmpControlTrack;
}
}
}
}
Anyone knows a better way of doing this? I thought about using controlTrack.GetInstanceID() and store them on a Dictionary using the scene name as the key or something like that, but i don´t really like the solution…
Thanks!
D