A few months ago I decided to rewrite/tidy-up and open-source a bunch of Unity add-ons I’ve written and regularly use. First up was UberLogger, a drop-in replacement for Unity’s debug console. Next up is something slightly bigger – UberAudio.
Much like UberLogger, UberAudio is designed to take something in Unity that’s good and make it better. Unity’s built-in audio system is very powerful, but I found the workflow fell a little short of my needs; but, as ever, the marvellous thing about Unity is that it’s so easy to extend. Specific areas of audio workflow that I wanted to improve include:
- Keeping AudioSource settings out of scenes and prefabs. If the settings of an AudioSource aren’t correct, you shouldn’t have to hunt around for it and check out a scene or a prefab. All your audio should be in one place, and not in a scene.
- Similarly, if you want an audio designer to do a pass on the audio in your game, they should be able to do so without touching levels, prefabs or code. They should be able to drop new audio into the game by themselves.
- Loading. You should be able to load up audio data without having to load a new scene. UI audio, audio variations, dropping audio for things you aren’t using to save memory, even swapping out audio sets entirely – you should have control over what’s loaded and when, without changing any game logic.
- Flexible audio triggering. It should be trivial to play a random sound from a selection. Similarly, if you’ve got a variety of different creature types and they share some sounds and not others, it should be easy to create defaults and override the ones you need, without touching code, scenes or prefabs.
- Lifetime management. If a creature is playing some audio when it dies, most of the time you don’t want the audio to die immediately with it; it should finish playing first. Likewise, if you have something that plays a looping sound (a buzzing bee, for example) and it dies, the loop should be released and then end naturally. This should be the default behaviour.
UberAudio solves all of these problems, and several others, and does so without getting in your way – you can always get a handle on your raw AudioSources if you need to. It’s based on the audio systems I wrote for Dungeon Keeper and Fable, so the core design has been tested in fairly intensive production environments and historically has scaled well.
The workflow is very simple:
- Create an audio bank.
- Add audio to your bank.
- Mount the audio bank in your scene.
- In code, trigger audio ‘events’ on GameObjects. These events have an intelligent lookup system (see the readme) so you can easily create default sounds and specialise them later on in your audio banks.
Editing audio banks in Unity looks like this:
As you can see, you have exactly the same level of control over how your audio behaves as with normal AudioSources but it’s all grouped together, with some extra fields for the new functionality.
Obviously this isn’t a competitor for great tools like wWise, but if you’re looking for something simple, flexible and free, UberAudio might be what you want.
Take a look and let me know if you find it useful. Feature requests, bug reports and pull requests are always welcome!