- Home /
How to trigger Timelines/ Playables from within a Timeline?
I know this is probably a stupid question, but I cannot figure out how to simply trigger another Timeline from within a Timeline.
For instance, I have Seq_01 and at the end of it, I want to trigger Seq_02 (which is a small looping anim). I tried putting Seq_02 into the Seq_01 Timeline as an activation track. It will play one loop of the anim and then stop. Seq_02 will trigger and loop properly if I have it set to 'Play On Awake', but that won't work for me since I don't want this Timeline to Play On Awake, I want it to be triggered.
I'm not really sure about the proper way to go about this, and I'm also not entirely sure how the Play On Awake function works for Timeline, it seems to behave not exactly how I would expect.
Any help is appreciated, thanks!
Answer by seant_unity · Mar 16, 2018 at 11:18 AM
Use a control track, instead of an activation track. It will automatically play the PlayableDirector on another gameObject.
Answer by DChap · Mar 17, 2018 at 01:05 AM
Thanks, I tried using a Control track instead of an Activation track, it sort of reacts the same way though.
I added a control clip to the end of Seq_01 and set the Source Game Object to Seq_02. I have Control Activation checked and Post Playback set to Active. It will play that one loop of Seq_02 at the end and then stop, even though Seq_02 (and the animation track in it) are set to loop.
It seems there is also a field for Prefabs on the Control clip, why are there two fields? Do the timelines need to be prefabs as well? Is there something special you have to do to get the new timeline (Seq_02) to loop as intended?
Thanks for the help!
Set the Wrap $$anonymous$$ode for the PlayableDirector on Seq_02 to loop. Then extending the control track clip will support looping.
As for the prefab field, if you supply a prefab with a playable director or particle system on it, the control track will automatically instantiate (and destroy) the prefab and control any playableDirectors and/or particle systems on it.
Hmm, Seq_02 is definitely set to loop. The Recorded clip in Seq_02 is also set to Loop in its 'Post-Extrapolate' setting. Also the clip asset itself has 'Loop Time' checked. I'm trying my hardest to tell this thing to loop.
What do you mean by 'extending the control track clip'? If I extend the length of the control track clip to say, 3 loops, then Seq_02 will play for 3 loops and then stop. The animation stops when the slider reaches the end of Seq_01.
Do you know if there are any tutorials or docs specifically about Control Tracks? I'm afraid I can't seem to get them to work and I don't know what I'm doing wrong.
Thank you for the help.
I think I misunderstood what you were trying to do. If I understand correctly you want to play Seq01, then at the end trigger Seq02 to loop indefinitely. Is that correct?
In the scene, disable the Seq02 gameObject but set it's playOnAwake flag to true, and make sure the wrap mode is set to loop.
Then use an Activation Track, but in the track properties set the PostPlaybackState to 'Leave As Is' (or Active). That will make Seq02 turn on Seq01 and the play on awake flag should take over. $$anonymous$$ake sure the clip is at the end of the timeline.
Hope that helps.
Thanks, yes that is correct and the way you described seems to be the only way to get the effect I'm looking for. If 'Play On Awake' is not checked then it seems like it will only play Seq_02 for the length of the Activation clip in Seq_01. I'm still a little unclear on the subtleties of the system, but this should be sufficient for what I'm trying to do- I think the key was making sure Seq_02 was disabled to start.
Thank you for all the help!
Your answer
![](https://koobas.hobune.stream/wayback/20220612154716im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Stop/start Animation Timeline on click? 0 Answers
TIMELINE: How to set a character’s initial position, without overriding the animation transforms? 2 Answers
Customize Timeline Clip background 0 Answers
Issue Creating Playables, Trying to create Track and clip at runtime 1 Answer
Add Curve key to Timeline CustomClip via C# script not working. 0 Answers