Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to know when a timeline is complete ?

Discussion in 'Timeline' started by Kiupe, Sep 4, 2017.

  1. bonickhausen

    bonickhausen

    Joined:
    Jan 20, 2014
    Posts:
    115
    It's very simple: Unity doesn't actually use their engine for games. Stuff like this is never going to get fixed because why should they when Timeline works perfectly for isolated tech demo videos?
     
  2. chisely

    chisely

    Joined:
    Jan 14, 2016
    Posts:
    5
    I've been working with Timeline for the past week and 90% of this time was spent looking for community solutions to problems that should have been fixed 3 years ago.

    Want parameters in signals? Nope, not supported, buy this 18 euro asset from the assetstore.

    Need OnComplete event? Here's a workaround that works in 1 of 3 director modes.

    Unity please, get it together. We need these features.
     
  3. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    422
    yeah, video player has something like loopPointReached - why timeline can't have something similiar?
     
  4. R1PFake

    R1PFake

    Joined:
    Aug 7, 2015
    Posts:
    530
    So a few years ago (around 2018) they promised:
    - A new completion event, that works with all modes (loop, hold)
    - Update to the documentation of the stopped event, to mention that it will not work with loop or hold mode
    - More states than Playing, Paused to detect the different between a "real" Paused and Paused because of "editor time isn't advancing"

    They told use to use a workaround by placing a signal at the end instead of adding a completion event, which is absurd, because we would have to manually place it on every timeline

    Today, year 2021, we have:
    - No promised completion event that works for all modes, still only stopped
    - The stopped documentation sounds very basic / generic and doesn't mention anything about loop or hold mode
    - Still the same states (Playing, Paused)

    I have a question:
    Did anything of the timline implementation change, so that these promised changes are not needed anymore, if so what's the new "correct" way to check if it is done (for all modes).

    I can live with using workarounds, but please don't promise anything if you don't care enough to actually implement it, especially something like a completion event which should be trivial to add on your side.
     
    Last edited: Aug 23, 2021
  5. xiao-xxl

    xiao-xxl

    Joined:
    Nov 16, 2018
    Posts:
    48
    Years have passed, has Unity solved this small problem? No. Unity only knows to engage in some high-impact things that can fool investors, and doesn't pay attention to community opinions at all.
     
    tonytopper, Ishimine and yaojianzhou like this.
  6. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    The children of mono are left to wander the timelines as the FAITHFUL pray to the LORDS of DOTS!

    (You will have to try workarounds)
     
  7. Midiphony-panda

    Midiphony-panda

    Joined:
    Feb 10, 2020
    Posts:
    242
    Bump
    (I also had to implement custom workarounds and watch the Timeline playing to know when it is actually completed)
     
    tonytopper likes this.
  8. pojoih

    pojoih

    Joined:
    Mar 30, 2013
    Posts:
    226
    I want to dig this up from the grave to annoy ppl who are responsible as Timeline is now a package, so it shouldn't be that hard to put a onlooppointreached action in here as I'm debugging my stopped, paused and played events for the fifth time now just to be remembered that nothing of this will get triggered at the end of a timeline.
     
    yzhao105 likes this.
  9. Ishimine

    Ishimine

    Joined:
    Mar 15, 2015
    Posts:
    5
    2022, no callback in sight...as usual the developers are so uptight about their design decisions regarding their tools, that they don't even address this extremely common problems that the users perceive on the way their software is expected to work... and decide to just ignore us.
    And no... registering to PlayableDirector.stopped, and then putting an if statement to check if it really is the end of the timeline or a call to the Stop method is not a solution.
    im not even goint to talk about the "add a signal", solution just plain ridiculous...
    Tools have to HELP the user to achieve something in a more efficient way, not ADD extra steps
     
  10. khan-amil

    khan-amil

    Joined:
    Mar 29, 2012
    Posts:
    206
    Hopefully contrarily to other packages and services the team working on timeline is more than just an intern split on 5 projects while the team is working on shinier timelines for Unity 2024.
     
    Midiphony-panda likes this.
  11. bonickhausen

    bonickhausen

    Joined:
    Jan 20, 2014
    Posts:
    115
    Hello! I come from the future. Just give up on using Timelines- they will break horribly on 2023.3 and importing the timeline package will turn your project unusable. They did however release yet another cinematic video with the help of some clever engine modifications and source hackery so the shareholders are happy!

    Just use animators and animation clips. Save yourself from this horrible future. Use Unity like it's Unity 5 and you're safe.
     
  12. Donitry9257

    Donitry9257

    Joined:
    Jun 2, 2021
    Posts:
    3
    my god! 5 years passed, Have we still not found a way? kill me please!
     
  13. DeadCastles

    DeadCastles

    Joined:
    Sep 23, 2019
    Posts:
    14
    GIVE US AN ON-COMPLETE FEATURE PLEASE!!!
     
  14. KuanMi

    KuanMi

    Joined:
    Feb 25, 2020
    Posts:
    41
    I can't believe this problem is still unresolved. I can't wait to see if timelines are used in Gigaya.:(
     
  15. R1PFake

    R1PFake

    Joined:
    Aug 7, 2015
    Posts:
    530
    It was kinda cancelled, so we will never know
     
  16. JVemon

    JVemon

    Joined:
    Jul 30, 2017
    Posts:
    18
    Me: Play this timeline.
    Unity: OK.
    Me: Is it finished?
    Unity: ¯\_(ツ)_/¯

    Five years.
     
  17. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,144
  18. zeropointblack

    zeropointblack

    Joined:
    Jun 8, 2020
    Posts:
    197
  19. bonickhausen

    bonickhausen

    Joined:
    Jan 20, 2014
    Posts:
    115
    Hi! Is this going to get fixed?
     
  20. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    758
    It's been over 4 years, is a useful feature that has been asked for by many, many people... so no, Unity won't be adding it ! :D
     
  21. florianBrn

    florianBrn

    Joined:
    Jul 31, 2019
    Posts:
    53
    Literally everyone I know who uses the Timeline complains about the lack of this, it's so basic I can't even understand why it was never done in the first place.

    I don't think we'll ever see it coming though, as development on Timeline seems completely stopped. According to the roadmap, the only thing related to Timeline that was released in 2 years is... a bunch of samples. The UI Toolkit Refactor is there since March 2021, there's no way this can take so long.

    Yet another great tool Unity dropped before being feature-complete...
     
  22. Pietrofonix

    Pietrofonix

    Joined:
    Aug 1, 2020
    Posts:
    54
    2023 and Unity still hasn't added the OnComplete event on the Timeline. Such a useful feature requested by many users completely ignored. Shame on you Unity
     
  23. bonickhausen

    bonickhausen

    Joined:
    Jan 20, 2014
    Posts:
    115
    Unity fired the entire Gigaya team, this is not a problem for them. They don't have to worry about callbacks for Timeline sequences. As long as they get to make their hair tech demos for their shareholders, they're good!
     
  24. hadtofall

    hadtofall

    Joined:
    Aug 28, 2020
    Posts:
    7
    2023 I came back to see if it was settled
     
  25. bonickhausen

    bonickhausen

    Joined:
    Jan 20, 2014
    Posts:
    115
    Of course not.
     
    Pier-Luc_Artisan and Carwashh like this.
  26. eterlan

    eterlan

    Joined:
    Sep 29, 2018
    Posts:
    177
    That's insane hahahah.
     
  27. eterlan

    eterlan

    Joined:
    Sep 29, 2018
    Posts:
    177
    Ok, I would do it in this way, hope it would help.
    If you don't use UniTask, use coroutine instead.

    Code (CSharp):
    1.         public static async UniTask PlayWithEndCallback(this PlayableDirector director, Action endAction)
    2.         {
    3.             director.Play();
    4.             await UniTask.WaitWhile(() => director.time < director.duration);
    5.             endAction?.Invoke();
    6.         }

    The lesson I leaned these years is simple, don't wait unity for anything, prepare to wrap another layer if you really want to use there packages.

    -----
    Never mind, I decide not to use timeline, it's not for game anyway.
     
    Last edited: Mar 20, 2023
    seoyeon222222 and tonytopper like this.
  28. tonytopper

    tonytopper

    Joined:
    Jun 25, 2018
    Posts:
    224
    I complain about this on every thread I have a chance to. Unity has awesome and powerful features that get shipped in an Alpha or Beta state and then don't get properly finished for years and years.

    The Playables system is a big one. I've worked with MANY animation APIs on other frameworks and platforms, so I can say with confidence, how the !#@k they shipped one without an on-complete event is blood boiling frustrating.

    This is why Unity's stock chart looks like this:

    upload_2023-4-27_9-18-37.png
     
  29. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    856
    Yet another work-around, only tested in 2023.2a13 Editor, and perhaps relying on a bug.

    Code (CSharp):
    1. PlayableDirector _timeline;
    2. bool _isDone;
    3.  
    4. void Update()
    5. {
    6.     if( !_timeline ){
    7.         _timeline = GetComponent<PlayableDirector>();
    8.         _timeline.extrapolationMode = DirectorWrapMode.None;
    9.     }
    10.     if( !_timeline ) return;
    11.  
    12.     if( !_isDone ) {
    13.         try{
    14.             _timeline.playableGraph.IsDone();
    15.         } catch {
    16.             Debug.Log( "Done" );
    17.             _isDone = true;
    18.         }
    19.     }
    20. }
    When the timeline reaches it's end IsDone() will throw a null pointer. PlayableGraph is a struct, so I guess it comes from unmanaged land. Anyway, I don't think this was how IsDone() was intended to be used :confused:
     
    Last edited: May 7, 2023
  30. Andy-Touch

    Andy-Touch

    A Moon Shaped Bool Unity Legend

    Joined:
    May 5, 2014
    Posts:
    1,477
    Dear Unity, if you add this API then the stock price will go up. I promise you.

    (Worth a try!)
     
  31. TheNullReference

    TheNullReference

    Joined:
    Nov 30, 2018
    Posts:
    262
    I know this is an old thread but I've been working with timelines a lot.

    I just check if timeline.time is approximately equal to timeline.duration to know if the timeline has finished.

    As others found out it was a lot of wasted debugging until I realised that the timeline state is unreliable.
     
    tonytopper likes this.
  32. Joshdbb

    Joshdbb

    Joined:
    Oct 28, 2014
    Posts:
    50
    6 years later and still nothing?
     
    Gasimo likes this.
  33. Ishimine

    Ishimine

    Joined:
    Mar 15, 2015
    Posts:
    5
    maybe if we find a way to slap the word "AI" in this feature request, the people that make decisions up in the chain of command, will green light this new and revolutionary "feature"
     
  34. clownhunter

    clownhunter

    Joined:
    May 26, 2013
    Posts:
    49
    +1 for an OnComplete callback
     
    tonytopper likes this.
  35. Andy-Touch

    Andy-Touch

    A Moon Shaped Bool Unity Legend

    Joined:
    May 5, 2014
    Posts:
    1,477
    Maybe it will get added for the 10 year anniversary of Timeline being released?

    If this was Godot, it would have been added by now by the community. :p
     
    Last edited: Jul 18, 2023
    Gasimo, Alic, xiao-xxl and 4 others like this.
  36. McSwan

    McSwan

    Joined:
    Nov 21, 2013
    Posts:
    128
  37. MichaelHeiml82

    MichaelHeiml82

    Joined:
    Nov 2, 2009
    Posts:
    30
    Yes and it works, but make sure about this: there is some setting (I don't remember the exact name) that forces the timeline to emit those signals even if the frame of the signal is skipped due to e.g. performance reasons. In the default setting, this is OFF, so sometimes signals would not be fired. Careful!
     
    McSwan likes this.
  38. Pietrofonix

    Pietrofonix

    Joined:
    Aug 1, 2020
    Posts:
    54
    Is this setting inside the Unity settings or in the inspector of the signal/timeline?
     
  39. Andy-Touch

    Andy-Touch

    A Moon Shaped Bool Unity Legend

    Joined:
    May 5, 2014
    Posts:
    1,477
  40. Ziplock9000

    Ziplock9000

    Joined:
    Jan 26, 2016
    Posts:
    360
    Unfortunately many years later and there's still very fundamental flaws with Timeline. This just happens to be one of the more easy ones to fix.
    The one that bugs me the most is events near the end of a clip being totally ignored due to how timing works. So you have to keep fudging where things get triggered.
    For me, it's pre-alpha due to that and other things.
     
    Andy-Touch likes this.
  41. McSwan

    McSwan

    Joined:
    Nov 21, 2013
    Posts:
    128
    I'd say6 he talking about this : upload_2023-8-31_22-26-39.png
    It's in the signal emitter
    upload_2023-8-31_22-29-44.png
    @Ziplock9000 @Andy-Touch I'm a veteran of 1, 8 second timeline. Can you guy suggest a better asset paid or free?
     
    Pietrofonix and MichaelHeiml82 like this.
  42. MichaelHeiml82

    MichaelHeiml82

    Joined:
    Nov 2, 2009
    Posts:
    30
    McSwan and Pietrofonix like this.
  43. Pietrofonix

    Pietrofonix

    Joined:
    Aug 1, 2020
    Posts:
    54
    McSwan likes this.
  44. eidosk

    eidosk

    Joined:
    Dec 9, 2013
    Posts:
    1
    This is such a basic feature! It is ridiculous that it has not been implemented... Another reason to switch to godot...
     
    insofan3156 and Carwashh like this.