Audio played from Unity Timelines does not get paused when an AC game is paused. This component can be used to pause it manually, as well as update its volume to AC Options values.

To use it:

  1. Paste the script below into a new C# file named TimelineAudioPauser.cs
  2. Attach the new Timeline Audio Pauser component to the Playable Director that is controlling the Timeline
  3. In the component's Inspector, set the "Sound Type" as well as the "Track Index" to control. Note that regular tracks start from index=1, with index=0 being reserved for events.

TimelineAudioPauser.cs:

using UnityEngine;
using UnityEngine.Timeline;
using UnityEngine.Playables;
using AC;

public class TimelineAudioPauser : MonoBehaviour
{

[SerializeField] private SoundType soundType;
[SerializeField] private int trackIndex = 1;

private AudioSource audioSource;
private PlayableDirector director;
private AudioTrack audioTrack;
private double pausedTime;


private void Awake ()
{
director = GetComponent <PlayableDirector>();
audioTrack = (director.playableAsset as TimelineAsset).GetOutputTrack (trackIndex) as AudioTrack;
}

private void OnEnable ()
{
EventManager.OnChangeVolume += OnChangeVolume;
EventManager.OnInitialiseScene += OnInitialiseScene;
EventManager.OnEnterGameState += OnEnterGameState;
EventManager.OnExitGameState += OnExitGameState;
}

private void OnDisable ()
{
EventManager.OnChangeVolume -= OnChangeVolume;
EventManager.OnInitialiseScene -= OnInitialiseScene;
EventManager.OnEnterGameState += OnEnterGameState;
EventManager.OnExitGameState += OnExitGameState;
}

private void OnInitialiseScene ()
{
OnChangeVolume (soundType, GetDesiredVolume ());
}

private void OnChangeVolume (SoundType soundType, float volume)
{
if (this.soundType == soundType)
{
audioTrack.CreateCurves ("nameOfAnimationClip");
audioTrack.curves.SetCurve (string.Empty, typeof (AudioTrack), "volume", AnimationCurve.Linear (0f, volume, 1f, volume));
}
}

private void OnEnterGameState (GameState gameState)
{
if (gameState == GameState.Paused)
{
if (director && director.state == PlayState.Playing)
{
audioSource = director.GetGenericBinding (audioTrack) as AudioSource;

audioSource.volume = 0;
pausedTime = director.time;
}
}
}

private void OnExitGameState (GameState gameState)
{
if (gameState == GameState.Paused)
{
if (director && director.state == PlayState.Playing)
{
director.time = pausedTime;
audioSource.volume = 1;
}
}
}

private float GetDesiredVolume ()
{
switch (soundType)
{
case SoundType.Music:
return Options.GetMusicVolume ();

case SoundType.Speech:
return Options.GetSpeechVolume ();

case SoundType.SFX:
return Options.GetSFXVolume ();

default:
return 1f;
}
}

}
Community content is available under CC-BY-SA unless otherwise noted.