Blog: Game Audio Scripting With Unity - Part 1

Game audio development platform revealed      03/03/14
Blog: Game Audio Scripting With Unity - Part 1

Adam Mclellan Writes:

I'm going to take a big departure in the next couple posts to talk about my other passion outside of computer music: game audio. Specifically, I'll be talking about the basics of integrating and scripting audio in Unity. For those who don't know, Unity is an excellent cross-platform game development engine which also boasts a feature-rich free version. 

If you've ever wanted to get involved with game audio but weren't sure where to start, picking up some Unity skills is a sure-fire way to find yourself some work. While some sound designers would stop at asset creation and hand off to somebody more technical to integrate, I say why not go the extra mile? There are many musicians and sound designers vying for a very finite amount of work in this space, and if you're able to not only create audio assets but also integrate them you'll be able to sell yourself that much more easily.

And fear not: if you've ever worked with Max/MaxForLive, Quartz Composer, etc. then you'll have no problem picking up Unity. Tthe amount of actual "scripting" required to integrate audio is generally quite minimal--just a few lines here and there.

In this month's post I'll start by introducing Unity and walking through some simple scenarios, like importing sounds and triggering them. Next month I'll explore more complex topics like reverb zones and scripting dynamic audio events.

Unity 101
First let's start with some basic terminology stuff:
  • Scene: everything starts with a scene. Think of a scene as a level. It could be a room, an outdoor environment, or something more abstract like a menu screen.
  • GameObject: a Scene is made up of GameObjects. A GameObject is simply a container to store Components--anything ranging from a Camera to a Light to an Audio Source. Important to note is that a GameObject can contain other GameObjects (which can in turn contain other GameObjects, and so on.)
  • Hierarchy: the Hierarchy displays all GameObjects in the current Scene.
  • Assets: An Asset is any custom-created or third-party asset used by your game--textures, models, scripts, and of course audio assets. You can view Assets from the Project view. Assets can be organized in folders and named any way you'd like, but if you're dealing with many assets it's important to give this some thought. For example, you may want to organize by type (sound effects vs music vs ambience), by level/scene, or both.
The types of Components we'll be dealing with for audio are:
  • Audio Listener: think of the Audio Listener as the player's ears. You should only ever have one Audio Listener in a Scene, and generally it will be on the same GameObject as the Camera component (the Camera being the players "eyes", in the case of a first-person game.)
  • Audio Source: Audio Source does what it says on the tin.
  • Script: A script allows you to script behaviour of a GameObject or its contained components (or technically, anything in the Scene, but we'll start simple.) Scripts can be created in C#, Java Script or Boo. We'll be using C# today.


More From: UNITY
Even more news...

5 Comments...  Post a comment    original story
Doug    Said...

Where can we find the free version of the software? I only see a 30 day trial at the website.

04-Mar-14 08:28 AM

Adam M    Said...

They're one in the same. They give you a 30 day Pro license when you download the free version, but it'll just fall back to the free feature set when the license expires.

04-Mar-14 08:47 AM

Sammy James    Said...


I appreciate this more than you know. When I've become a world-famous movie and game score composer, I will not forget the lessons that you've taught me. I will share my vast knowledge of sound design, by posting a similarly-educational article to Sonic State. But for now, I need to get so famous -- and you have helped me immeasurably to get to that point.

Thank you again.


Sammy James

04-Mar-14 05:02 PM

Love Unity    Said...

nice, keep going, thanks

06-Mar-14 07:52 PM

can    Said...

Thanks for the tutorial!

09-Jun-14 05:58 AM

Post a comment 

More Videos

Sonic LAB: ROLI Seaboard Rise 49 Controller 

5D Touch is different and very expressive

MESSE 2016: Universal Audio UAD2 Satellite USB 

A Satellite for your Windows machine!

MESSE 2016: New Audio Technology Spatial Audio Designer 

A new plug-in for creating 3d spaces on your regular headphones

Superbooth 2016: Ken MacBeth New X-Series Proton 

Evolution of a new voice core module coming soon