Search Unity

ProcessFrame() being called constantly after end of timeline while in Edit Mode

Discussion in 'Timeline' started by KristofferH, Nov 26, 2021.

  1. KristofferH

    KristofferH

    Joined:
    Oct 27, 2012
    Posts:
    52
    When I press the play button in the Timeline editor window everything works as expected, the playback stops at the end of the timeline. But when I use an editor script that calls PlayableDirector.Play() it never stops playing, the ProcessFrame() is being called forever and ever. If I enter Play Mode in Unity everything works as expected again. What is going on here? I haven't been able to figure out where to start looking for errors? Is this a bug in 2020.3.23f1, I've done similar things in 2019.4 without issues. Or is this an expected behaviour in Timeline, that the PlayableDirector.Play() should not be working the same in Edit Mode and in Play Mode?

    Unity 2020.3.23f1
     
  2. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    542
    Yes it's expected.
    The Timeline Window and the Director Component function differently.

    In Timeline 1.7.0-pre.1 (slated for 2022.1), there's a new API that lets you invoke the playback controls of the Timeline Window, instead of driving the DirectorComponent.
     
  3. KristofferH

    KristofferH

    Joined:
    Oct 27, 2012
    Posts:
    52
    @DavidGeoffroy How come this works in 2019.4 then? And more importantly, how do I get around this in 2020.3? I need to be able to trigger the director from code since there are also other methods that needs to be triggered at the same time, and I don't want to have to go into Play Mode just to preview that everything looks correctly while still editing. As I said, this worked fine in 2019.4, will I have to wait for 2022.1 just to get an old feature back? :)
     
  4. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    542
    No.
    I expect your PlayableDirector's wrap mode is set to Hold instead of None, and it was set to None in previous tests you did.

    It's expected that the PlayableDirector with wrap mode Hold will keep evaluating forever unless you actively stop it.

    You can start a coroutine to stop it when the director's time is higher than the duration, or change the PlayableDirector's wrap mode to None.
     
  5. KristofferH

    KristofferH

    Joined:
    Oct 27, 2012
    Posts:
    52
    @DavidGeoffroy That sounded like a plausible explanation, but no, my director wrap mode is set to None. The clips in the timeline themselves are set to hold for Post-Extrapolation, will that also cause this issue?
     
  6. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    542
    At this point, I would advise you to file a bug with a small-ish repro project. It sounds like there has been a change in behavior, and we'll need to assess exactly when, why, and if the change was justified.

    If the change wasn't intentional, we will probably revert it, but if we can't revert the change without regressing on something else, there's a chance that the behaviour will stay the same.
     
  7. KristofferH

    KristofferH

    Joined:
    Oct 27, 2012
    Posts:
    52
    I'll see if I can recreate the issue with simplified code and send in a bug report, unless I find out that the error was on my part :)