Search Unity

Reverse the Timeline animation

Discussion in 'Timeline' started by flar323, May 6, 2019.

  1. flar323

    flar323

    Joined:
    Jun 24, 2015
    Posts:
    1
    Hi,
    I'm new to unity timeline ,i just wanna play the timeline animation in reverse. I have a simple character forward walking animation i want the animation to play in reverse,when in press backward key.
     
  2. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    That isn't built-in to timeline or the playable director, mainly because not all tracks can support it - like audio.

    You can acoomplish it via script by setting the playableDirector playmode to Manual, setting the time (time -= Time.deltaTime, for example) and calling DeferredEvaluate(), but in this mode Markers and Audio won't play.
     
    andrew_ES likes this.
  3. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,555
    It would be very handy if just the AnimationPlayableAsset (the clip) is reversible by a boolean check box on the clip! My main use is for those UI and transition animations where I want to have it close the same way it open but in reversed direction (and probably a bit faster/slower, and time stretching is already possible with this type of clip asset). This way when I update the open animation, the close animation could be updated together. I think this wouldn't be so destructive to the whole time continuity guarantee of the playable system like if we make everything reversible.
     
    amesa_unity and Rib like this.
  4. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    Agreed, good suggestion @5argon, and not the first time this has been asked. I believe it is on our feature backlog. Animation Clip playback has been optimized to play forward, and so playing a clip backwards by reversing time flow is not an efficient way to play the clip. This is what happens with PingPong extrapolation currently. But having a clip that is known to play backwards would allow optimal playback as well.
     
    Rib and 5argon like this.
  5. GeorgeAdamon

    GeorgeAdamon

    Joined:
    May 31, 2017
    Posts:
    48
    Vaupell likes this.
  6. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    No, unfortunately nothing has changed on this. The best way to currently do this is to reverse the animation clip itself -- discussed here, with a sample script to convert the animation clip itself.
     
  7. Vivraan

    Vivraan

    Joined:
    Feb 2, 2018
    Posts:
    26
    Again, this a feature built right into Godot.
     
  8. Vivraan

    Vivraan

    Joined:
    Feb 2, 2018
    Posts:
    26
    The link points to an excellent script but unfortunately it uses an obsolete function. What would be the way around using
    AnimationClipCurveData
    ?
     
  9. babels

    babels

    Joined:
    Feb 1, 2020
    Posts:
    2
    yeah... no, the best way to do this is in the animator of a actual 3d program like blender or 3ds max. the process involves dragging and clicking on the desired keys as well as copy n paste. Yes it will make your file larger. Yes it is worth tradeoff for speed at runtime... even on mobile. How can so many coders not understand what a gui is
     
  10. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,364
    And 2 years later?
     
    Vaupell likes this.
  11. GregMadison

    GregMadison

    Joined:
    Aug 2, 2015
    Posts:
    1
    Same as 5argon . Need that so much for UI animations :(
     
    Vaupell likes this.
  12. Vaupell

    Vaupell

    Joined:
    Dec 2, 2013
    Posts:
    302
    Ha, was searching on this today, and ended up here finding out it's not supported..
     
  13. browne11

    browne11

    Joined:
    Apr 30, 2015
    Posts:
    138
    Would love to see this supported! But can work around it :(
     
  14. Eric-Farraro

    Eric-Farraro

    Joined:
    Apr 23, 2013
    Posts:
    31
    Suprised this isn't supported. It'd be very useful for UI animations (such as when a UI appears / disappears)
     
  15. BeauJames

    BeauJames

    Joined:
    Jan 5, 2022
    Posts:
    1
    I was trying to find a solution to this to no avail as well. A hack that seemed to work for me was to turn the animations into clip tracks, ping-pong them, drag their clip playhead to where they would normally end, then select fixed length duration for the timeline and end it where the new tracks are now set to begin. Because they are set to ping-pong, they should now all play back to front to begin with and then end before they start playing forward again. Make sure there are keyframes at the start and end for each track when doing this. Hope it helps!
     
    Retrokat likes this.
  16. dylanmanningke10

    dylanmanningke10

    Joined:
    Jan 26, 2022
    Posts:
    5
    I think that it isn't built-in to timeline or the playable director, mainly because not all tracks can support it - like audio.
     
  17. jbergs

    jbergs

    Joined:
    Feb 13, 2014
    Posts:
    26
    But why can't it be an option on clips that can support it? This, and cut-paste keys is really needed.
     
  18. petersvp

    petersvp

    Joined:
    Dec 20, 2013
    Posts:
    63
    I'm doing it with manual time line update and DeferredEvaluate - and no performance issues in all my use cases [yes. neglectible...]