[AUDIO] Audio Manager Tools

TEMPLATE NAME: Audio Manager Tools
CORE VERSION: 1.10.3
TEMPLATE VERSION: 1.0.0

TEMPLATE DESCRIPTION:
Create Simple and Complex Background Audio for your games, by dragging and dropping Templates, Scripts, Audio Tracks and SFX. Honestly no coding required!

TEMPLATE ROADMAP:

  • Undefined, I want to get feedback before making further decisions.
    Current Ideas: Audio management without using Triggers, Event driven Audio Management, Resource change Audio Management

TEMPLATE VERSION NOTES:
1.0.0 - Initial Release

MEDIA:
Link to the video tutorial: https://youtu.be/V5VdANzyTlg

ADDITIONAL INFO:
Please leave any feedback, future additions, or any bugs/problems you’ve had in the comments below.

CONTENTS:

  • Overview
  • Example Setup
  • Tutorial: Setup your own trigger
  • Bonus: One Shot SFX Audio Triggers

OVERVIEW

This community content was created to provide an easier implementation of background audio to your games.

It’s a drag and drop system, with no need to know any Lua.

However, even though it’s a simple setup there's a lot you can use this for.

QUICK SETUP:

Once you’ve downloaded the community content you’ll find it in the Project Content Folder, under imported content.

Next, click and drag the Example Background/Environment_Audio_Triggers template into your hierarchy.

Note: it should appear at Transform: Position at 0,0,0

Next, let’s press play at the top of the editor.

Once in preview mode run around the small area, testing out all the different triggers.

  • Red Cube Trigger - Western Themed Background music

  • Green Cube Trigger - Forest Background music

  • Blue Projection - Space background Music

That’s the quick setup using the example template, in the next section we’ll look at setting up your own trigger and background audio to work in your own game creations.

TUTORIAL: SETUP YOUR OWN TRIGGER

First let’s go ahead and delete Example Background/Environment_Audio_Triggers from the hierarchy.

Now drag in the Template Background/Environment_Audio_Triggers template into the hierarchy.

Open up the folders in the Hierarchy until it looks like this

Folder Structure:
Important note:
(The folder structure is very important for the Audio Manager/Triggers to work correctly. If you are choosing to use this CC as your Background Audio Manager ensure this folder structure stays the same, however feel free to change the names of the folders/core objects.)

Template Background/Environment_Audio_Triggers

  • This is the parent object, it’s only role is to house the background audio triggers and audio tracks with a name you’ll recognise in your hierarchy.

Client Context

  • Any children of this folder are Client based only (note this Background Audio Manager is currently only setup to work on the client side)

All_Music_Tracks_Folder

  • This folder is housing each Triggers Audio Tracks
  • eg. Found in the “Zone_01_Trigger_AudioTracks” is all the Audio Tracks the “Zone_01_Trigger” needs access to.
    • From here you can also access the audio properties of an Audio Core Object.

Zone_01_Trigger

  • This core object is a trigger not a folder
  • It is the parent object of the scripts used to manage the background music for your game.

Create a Template

  1. Right-Click the Template Background/Environment_Audio_Triggers and select “Deinstance this Object”.

  2. Now let’s change the name of the folder to Background Audio Triggers

  3. Then Right-Click the folder to Background Audio Triggers and select “Create New Template From This”

Great, now that we have created our new template we won’t make changes to the template called Template Background/Evironment_Audio_Triggers

Zone Audio Trigger

Open up Zone_01_Trigger

You’ll notice 3 different scripts:

  • SFX Audio Trigger
  • Zone Audio Trigger
    • It’s vital for the trigger to contain at least one Zone Audio Trigger script.
  • Zone_Enabled_Script
    • It’s vital for the trigger to contain this last one(And only one).
  • Cube (isn’t used for anything other then visual representation when in game, you’ll likely want to remove this before publishing your game)

NOTE:
(I recommend looking through each scripts properties. You can hover over the property name for a tooltip of what each property does.)

Now go ahead and delete duplicates of each script, only leaving one script of each.

Note: You may need to select “Deinstance and Delete” if the pop up appears.

The trigger and it’s children should now look like the below image.

Save (ctrl + s) and preview trigger in play mode ( = ), making sure there isn’t any errors.

Edit the Audio:

Now let’s change the audio to play.

Open up the folder called All_Music_Tracks_Folder

Then open up the folder called Zone_01_Trigger_AudioTracks

Now go ahead and delete all the audio tracks in this folder.

The folder structure should now look like this.

Now that all the audio tracks are deleted let’s add our own!

Go to Core Content > Audio > Ambience Backgrounds

Click and drag the selected audio track into the folder Zone_01_Trigger_AudioTracks

For this example I’m going to use Ambient Dark Breathy Cave Dungeon Loop 01 SFX

Once the Audio track is in the folder head down to it’s properties and untick the following bools; “Enable Spatialization”, “Enable Attenuation”, “Enable Occlusion”

The properties should now look like this

Now that we have an Audio Track in the folder, we can now reference this Audio Track for use in the Zone Audio Trigger script.

Click and Drag the audio track into the property called “Track_To_Play” on the script, and tick the bool “Loop_Track”.

One last thing before we press play and test.

Let’s go ahead and delete the SFX Audio Trigger we won’t need it for now, then press play and test out our trigger.

It should now play Ambient Dark Breathy Cave Dungeon Loop 01 SFX once entering the trigger.

NOTE: You may notice a delay, if we look at our property “Wait_Seconds_BeforePlay” on the Zone Audio trigger, you’ll notice it’s set at 5. Let’s go ahead and make that 0.

Save and then press Play to test again.

It should now play immediately.

SFX Audio Trigger

We now have a background ambience sound for our game, but let’s make it a little more interesting.

On entering the trigger let’s play a SFX or stinger.

For this example i’m going to use the SFX Creature Ghost Breath 01 SFX

Add the audio track/SFX of choice to the folder called Zone_01_Trigger_AudioTracks, then edit its properties if needed (I recommend unticking the same bools we did previously)

Now let’s go edit the properties of the SFX Audio Trigger script found in the Zone_01_Trigger

However we did just delete this, so instead we need to drag the template called SFXAudioTrigger_Template into the Zone_01_Trigger core object.

Once it’s in there you’ll notice its text is red, we want to right click the core object and deinstance.

Then change its name to SFX Audio Trigger.

And finally click and drag the Audio Track/SFX you want it to play into its “OnEnter_SFX” property.

Save, press play and test your audio trigger.

It should now play the audio track/SFX that you placed in the “OnEnter_SFX” when the player enters the trigger.

Congratulations you’ve set up your own Audio Trigger using this Community Content!

From here on I highly recommend checking out the Example Template again to see how I’ve set up some of those Audio Triggers, the Western trigger is most complex while the space station is most basic.

I have also implemented it already in my core game “Lumberjack Valley” which you can check out here:

BONUS: One Shot Triggers

Overview: One shot triggers are used to play a single SFX/Audio Track, it’s best use is for objects that shouldn’t be heard all the time. For example stepping on branches, in a puddle, a trap, etc…

They’re self contained in one trigger to keep it as simple as possible for use in your games.
Here is the trigger structure/example.

I recommend exploring this trigger to understand how to set it up.

I hope you find this Community content useful in your game creations, also please leave any feedback, bugs or what you’d like to see added to this community content in the comments below.

2 Likes

Quick glance through this thorough description and, "wow". This is what we (I) really needed. Audio tends to be an afterthought for me. mainly because I don't know much about it. Thank you for lowering the barrier to entry. Much appreciated. :fire: :fire:

2 Likes

I couldn't agree more with the "afterthought" statement, it's something I tend to leave till last (which I need to avoid)

But hopefully with this initial release of this CC I can provide an easier solution for those that want to add background audio/ambience to their games with ease.

Also let me know if you implement it in any of your games, have any problems, questions or want to see something added to it. I'm very open to feedback on this CC

2 Likes

This looks really well thought out and useful!

2 Likes

hi,
very nice tool !

i have a question :slight_smile: how i stop music when i change zone ?
because when it plays the new sound, it continue to playing the sound of the old zone