Forum rules - please read before posting.

Pausing timelines - Audio not pausing

edited March 2021 in Technical Q&A

Unity Ver: 2019.4.18f1
AC Ver: 1.73.2

Hello,

In my scene I have a timeline which has an audio track for music, however when bringing up the pause menu the audio isn't pausing.

I came across this AC script here however after following the instructions and adding to my timeline the audio still carries on when the pause menu is active.

It's use also throws the following warnings into my Unity console:

Does anyone here have experience pausing audio in a timeline?

Comments

  • edited March 2021

    It seems if I reconfigure the script to use:

    https://docs.unity3d.com/ScriptReference/Playables.PlayableDirector.Pause.html
    &
    https://docs.unity3d.com/ScriptReference/Playables.PlayableDirector.Resume.html

    then the timleine and audio appears to pause and resume correctly with AC. This however creates a new problem where on resuming it'll start to process actions set after the timeline, even though wait until finish? is set to true.

    For instance this setup:

    Upon resuming the actions after the timeline are been processed, even though the timeline hasn't yet finished.

  • If you manually stop the Timeline's playback, the Action will consider it finished and so move onto the next.

    Replacing the Wait until finish? Action with an Engine: Wait Action of the Timeline's duration would be a hacky-but-effective workaround, but ideally the wiki script shouldn't need modifying in the first place.

    The warnings suggest it's related to the Job system, which the script certainly isn't using. Are you using the Job system / Burst compiler? It may be a bug with Unity itself, the wiki script code shouldn't cause issue.

  • edited March 2021

    Hey Chris. So I'm clear, if PlayableDirector.Pause is used, the action would consider the timeline finished?

    Re the wait issue I went ahead and split the post-timeline actions into a new action list and added an event to the end of the timeline to trigger them. Feels like a better and clearer setup rather than having an action list that pauses for a substantial time in the middle.

    With the wiki script as is though I had no joy pausing audio with it, but I'll give it another go tomorrow.

    I think you're absolutely right about the job warnings being a Unity bug.

  • edited March 2021

    So I'm clear, if PlayableDirector.Pause is used, the action would consider the timeline finished?

    Yes. At least so far as I'm aware, there's no easy and reliable way to tell the difference between the Timeline being manually paused vs naturally ended.

    Even so, it's arguable that - in the event that a user manually halts a Timeline's playback - having the Action end would be the more commonly-desired outcome, as opposed to having it hang forever unless it's manually resumed again.

  • edited March 2021

    An easy way to pause audio in the Timeline is to create a Signal Track in the Timeline.

    First, add a Game Object to the scene and configure it to use Adventure Creator's audio (Use a mixer or the AC audio component). Once you have that Game Object set up in your scene, activate the Game Object using a Signal in your Timeline. Doing so will allow you to pause audio during gameplay. Make sure it doesn't start on frame 1 in the Timeline.

    You should be able to find a 'How-To' for Timeline Signals on Youtube. You'll be instructed to create/add a Signal to an asset folder, and connect that Signal to the audio Game Object in your scene. Not sure if you're required to create a Signal for each audio file, but I feel it keeps it tidy.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.