Audio Tracks Using Timeline in Unity 2020

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!

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

HEALTHCARE INDUSTRY: SMART IOT SOLUTION​ FOR SENIORS

It’s 2017 — Are Your Queries Still Vulnerable to SQL Injection?

Building a Yahoo Finance Scraper in Go, saving to CSV and optionally sending yourself an email

Enterprise Microservices Design [Part 4: External Architecture Zone]

A must-know technology for any full-stack developer ; MongoDB

Velas $5 Million Grant: WHAT YOU SHOULD KNOW

How to unit test an AWS Lambda

Why learn JavaScript?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
GameDev Dustin

GameDev Dustin

More from Medium

VFX — Adding Enemy Explosions

Add Emissions to Texture Maps with Gimp

Setting up Git for Unity

Image Courtesy of ARreverie Technology

From Prototype to Work of Art