Search Unity

How to nest timeline targeting a same object ?

Discussion in 'Timeline' started by Kiupe, Apr 9, 2019.

  1. Kiupe

    Kiupe

    Joined:
    Feb 1, 2013
    Posts:
    528
    Hello,

    I'm trying to nest timelines that play on the same object. For example, I have a HeroController object and I create a Timeline for different kinds of animations (fake examples) : jump, run etc. Now I what a Timeline to make the hero run and jump so it would be nice to use the previous created timeline.

    I tried using a controller track but if I target the HeroController I have a warning explaining that it is using the same PlayableDirector.

    I tried to create prefabs containing the PlayableDirector targeting the Timeline for jump and run. Then create another one for the runAndJump with a controller track and then target the other prefabs to play the jump and run animations (timelines) but it does not work.

    Obviously I'm doing something wrong here. How would you nest Timelines in order to nest "animations/sequence" acting on the same object in order to be able to compose new Timeline (jump, run, jumpAndRun = jump + run)

    Thanks
     
  2. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    If I understand correctly, you would need to make sure the playable director is not on the gameObject you are animating.

    Example, you have 4 playable directors
    jump - contains an animation track, bound to Hero
    run - contains an animation track, bound to Hero
    jump and run - contains a control track that controls jump and run playable directors, OR an animation track with jump, then run.
    master - It has a control track that has multiple clips like:
    [jump][run][jump and run][run]

    The master is what would be played. But if you create a loop (i.e. jump->calls run-> which calls jump) timeline will detect it and produce a warning.

    The nesting is done by one playable director playing another, and not by nesting the content. So circular references won't work.

    Hopefully that clarifies it a bit Maybe this is the setup you have, and the cycle detection isn't correct.
     
  3. Kiupe

    Kiupe

    Joined:
    Feb 1, 2013
    Posts:
    528
    Hi,

    So if I get it right it is not possible to play a timeline inside a timeline, which is really a shame because it would be the most intuitive way to nest/compose things and if I want to re-use timeline I have to create separate objects and have as mush object + playable director + timeline as "animations/sequences" I want, am'I right ?

    And when I want to play one of those "animation/sequence" I have to do what ? To dynamically assign the object to the master control track ? I mean, I already create the "run" object and I want to play it, how should I do that ? It already exist, i don't want to re-setup something in master that indicates how to play "run". Does that make sense ?

    Thanks.