Pausing Timeline Audio

Hey there,

I’m implementing pause functionality in my game. AudioListener.pause doesn’t pause timeline audio. Is the only way to pause audio tracks on a timeline that’s running in game time to do:

playableDirector.playableGraph.GetRootPlayable(0).SetSpeed(0);

?

The problem I’m running into is that I have 100s of directors in my scene so keeping track of which ones are playing would be some overhead.

Edit:

It seems that code doesn’t even work because it causes the audio track to stop playing before it’s complete by the amount of time you had the experience paused for.

Edit #2:
I circumvented the bug in the first edit by caching the time using GetTime() on the director playable on pause and then using SetTime when I’m ready to unpause to restore the time. Not sure what this does.

1 Like

Realized the AudioListener.pause not affecting timeline audio is actually bug that’s been discussed here: Setting Time.time to 0 pauses all timeline tracks except from audio

1 Like