Audio Tracks Using Timeline in Unity 2020

GameDev Dustin
3 min readMar 30, 2022

The first thing we’ll do is create an empty game object, reset its Transform component settings, and child it to the “Directors” empty game object.

Next, with AudioTrackTest-Director game object selected and the Timeline window open, we’ll click “Create” in the Timeline window.

This will add a Director in our project folder / Hierarchy window as well as adding a Playable Director component to our AudioTrackTest-Director game object.

We’ll need a sound file to play with, I’ve downloaded a random audio file from the GameDevHQ filebase, but you can use any audio file.

Dragging in our audio file into the Timeline window on the left side panel creates an audio track using said file.

I’ve then went ahead and eased-in and eased-out the track by holding the CNTRL key and dragging each side as desired.

When I hit play, it sounds as expected (for me, above is just a GIF, no audio).

If you’d like the audio to loop, select the correct Director game object in the Hierarchy and set “Wrap Mode” on the Playable Director component to “Loop”.

Something to note, I have not tied this audio in with the cube/sphere animations.
That means the audio plays independently.

If you had an audio sequence that needed to be tied to animated game objects, you would place that audio source on the same Timeline Director as the animation for those game objects.

Also note that you can add multiple audio sources to a Timeline and mix them as desired.

Making Our Audio Spatial

Instead of our audio being ever present in the game world, we can assign it to a source.
Since we don’t have any game objects with audio source components on them, I’m going to use an existing game object.

You could just as easily create a new game object, place as desired, and use that.

I’ve dropped my cube game object onto the audio track’s audio source.

As seen above, this added an audio source component to my cube automatically.

Now we can play with the audio settings here to fine-tune the spatial effects of this audio.

That’s it for this article!

--

--