Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

PlayableDirector.State is always PlayState.Paused

Discussion in 'Timeline' started by junglemason, Jun 24, 2018.

  1. junglemason

    junglemason

    Joined:
    Dec 30, 2010
    Posts:
    69
    I'm trying to control a PlayableDirector (w/ Timeline asset) with code. In a behaviour's Update method, I'm checking:
    Code (CSharp):
    1. private void Update() {
    2.     if (myDirector.state != PlayState.Paused) { ... }
    3. }
    But it always returns PlayState.Paused, even when it's playing and the playable graph is valid. Am I doing something wrong? I'm using 2017.4.2 (I searched more recent release notes for a bug fix but didn't see anything about it).
     
  2. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    The state returns playing when
    • The graph is valid.
    • Play has been called on it, and the engine is advancing it's time.
    • The timeline has not completed.
    • IIRC it may return paused if the time update mode is manual
    You can check if playableDirector.playableGraph.isPlaying returns true. If it does, and the state returns Paused, then you may have encountered a bug we aren't aware of.
     
  3. Tim-Wiese

    Tim-Wiese

    Joined:
    Jul 7, 2012
    Posts:
    82
    I am getting this same error. After upgrading from 2017.2.1 to 2017.4.6f1

    I tried the playableGraph fix but the playableDirector.playableGraph.IsPlaying() also returns false.

    PlayableDirector:
    Update Method = Game Time
    Wrap Mode = None
    Initial Time = 0

    Timeline:
    Frame Rate = 60
    Duration Mode = Based On Clips

    I am checking IsPlaying() and PlayState in LateUpdate

    Although the timeline is playing, I can watch it. I can also see Current Time on the Playable Director Component counting up, while the code still claims its paused/not playing.
    So for now I'll probably just check is playing by checking current time vs duration manually, until this is fixed.

    I have also tried create a new Timeline from scratch, but still getting the issue.


    *Edit:
    I was able to fix this by deleting the Library folder in my project folder and letting everything re-Import. I had a hunch it was something like this when other people on the project had the exact same files, but their cutscenes worked, and mine didn't.
     
    Last edited: Jul 4, 2018
  4. Suduckgames

    Suduckgames

    Joined:
    Nov 28, 2016
    Posts:
    218
    I had the same error, however restart unity seems to fix the issue
     
  5. Tim-Wiese

    Tim-Wiese

    Joined:
    Jul 7, 2012
    Posts:
    82
    This problem came back today, I'll try just restarting Unity this time.

    *Edit
    Just restarting Unity fixed this, I'll see if I can pinpoint what causes it to stop working this time.
     
    Last edited: Jul 4, 2018
  6. Suduckgames

    Suduckgames

    Joined:
    Nov 28, 2016
    Posts:
    218
    In my case, I check If it is valid in a Corutine. Currently I only find this bug on the editor( checked on Android device ) but It will nice to know if this bug can appear in production environment.

    It is very difficult to get a repro project to sent for bug report, since when you restart unity it gets fixed
     
    Last edited: Jul 5, 2018
  7. julienb

    julienb

    Unity Technologies

    Joined:
    Sep 9, 2016
    Posts:
    177
    Hmm... I'm currently investigating a bug which I think is exactly your problem. (What a coincidence!)
    Basically, the repro steps are:
    1. Go in play mode
    2. Play timeline/director
    3. Pause the editor and exit Playmode
    4. Go back in play mode, then play the timeline/director.
    The director is playing, but its state is not PlayState.Playing. This issue appears in Unity 2017.3 and later. As a workaround, for now, you can enable/disable the Pause button to fix the issue. Restarting Unity will also work. This is only in the editor, the player will not encounter this bug.

    I'll keep you updated.
     
    Last edited: Jul 9, 2018
  8. Cleverlie

    Cleverlie

    Joined:
    Dec 23, 2013
    Posts:
    219
    any news on this bug? it happened to me too in 2018.1.0
     
  9. jmsr

    jmsr

    Joined:
    Mar 1, 2018
    Posts:
    1
    This is a very related issue I am experimenting since 2017.3.1 until now (2018.2.2), but it happens just with the building of my project in WebGL. Editor, Windows build and Android build do not have this problem for me.

    Could it be possible the graph state is being partially invalid for some reason, although it can be played anyways?

    Edit:
    Testing my problem further, it really has to be with the state of the inputs inside the mixer of my custom playable, NOT the state of the playable director. They are always paused in WebGL build, but working well in Editor and Windows/Android builds.
     
    Last edited: Aug 7, 2018
  10. julienb

    julienb

    Unity Technologies

    Joined:
    Sep 9, 2016
    Posts:
    177