Search Issue Tracker

By Design

Votes

0

Found in

2018.4

2019.2

2019.3

2019.3.0b9

2020.1

Issue ID

1196325

Regression

No

Custom Audio Asset doesn't emit sound when played in Timeline

Timeline

-

How to reproduce:
1. Open the attached project's Scene labeled "SampleScene"
2. Select the "Timeline" GameObject from the Hierarchy
3. In the Timeline Window's tab press "Space" Key to Play the Timeline

Expected result: there's sound emitted from the CustomAudioPlayableAsset Audio Track
Actual result: there's no sound emitted from the CustomAudioPlayableAsset Audio Track

Reproducible with: 2018.4.13f1, 2019.2.14f1, 2019.3.0b12, 2020.1.0a14
Couldn't test with: 2017.4 (Audio.AudioPlayableBinding does not exist)

Note: CustomAudioPlayableAsset Audio Track emits sound when scrubbing with "Audio Scrubbing" enabled in Timeline

  1. Resolution Note (2020.1.X):

    Timelines built-in audio track requires some internal components to work. It calls AudioClipPlayable.Seek explicitly, which you can replicate using the following modifications to the script provided.

    using UnityEngine;
    using UnityEngine.Audio;
    using UnityEngine.Playables;
    using UnityEngine.Timeline;

    [CreateAssetMenu]
    public class CustomAudioPlayableAsset : PlayableAsset, ITimelineClipAsset
    {
    public class SeekBehaviour : PlayableBehaviour
    {
    public AudioClipPlayable clipPlayable;

    public override void OnBehaviourPlay(Playable playable, FrameData info)
    {
    clipPlayable.Seek(playable.GetTime(), 0);
    }

    public override void OnBehaviourPause(Playable playable, FrameData info)
    {
    clipPlayable.Pause();
    }
    }


    public AudioClip clip;
    public bool propagate;

    public ClipCaps clipCaps => ClipCaps.All;

    public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
    {
    var acp = AudioClipPlayable.Create(graph, clip, looping: false);
    var sp = ScriptPlayable<SeekBehaviour>.Create(graph, 1);

    sp.ConnectInput(0, acp, 0);
    sp.SetInputWeight(0, 1);

    sp.GetBehaviour().clipPlayable = acp;

    return sp;

    }
    }

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.