PlayableDirector.State is always PlayState.Paused

I’m trying to control a PlayableDirector (w/ Timeline asset) with code. In a behaviour’s Update method, I’m checking:

private void Update() {
    if (myDirector.state != PlayState.Paused) { ... }
}

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).

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.

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.

I had the same error, however restart unity seems to fix the issue

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.

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

Hmm… I’m currently investigating a bug which I think is exactly your problem. (What a coincidence!)
Basically, the repro steps are:

  • Go in play mode
  • Play timeline/director
  • Pause the editor and exit Playmode
  • 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.

3 Likes

any news on this bug? it happened to me too in 2018.1.0

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.

The bug is fixed in

3 Likes