Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
There's a number of ways we can put audio into our scene. There all going to be an audio source, but we really need to think about when do we hear a sound. For this game there's not really a backing music or overall track that rides over the entire game. If you do need one of those put an empty game object into your scene and an audio source, and simply let it come on and not really have a fixed range to it. You'll have music throughout the game. What I'm going to do is similar, but I'm going to put a range on. And I'll use that interior room tone for each building.
Basically, ranging it in the room in a large area, so that when you're in the building, you do hear the vents, and it is a little bit positional, but definitely starts to fade out once you go outside. I'll begin by hiding my water and terrain so I can see my buildings and navigate around a little more easily. I'll hide the water, and then the terrain object. And, I'll also turn off the effects at the top of the scene view. Now, get in some game objects. Choosing Game Object>Create Empty. And I'll name this one, Building A Interior Sound.
This will be my room tone and I'll have one for buildings B and C as well. Now I'll attach an audio source to it, choosing Add Component>Audio>Audio Source. As you can see we've got a bunch of different components to add. Different filters, distortion, echos and so on. For example, if we needed a reverb zone, where our character has footsteps and we enter into a cave and we hear those footsteps reverberate, we could add a reverb zone to it. And that way when we hear that audio it'll be echoing as if we're surrounded by rock.
I'll pick my audio source and then I'll get my audio clip in. I'll click on the Pick button for the audio clip and choose Interior Tone. I'll move this into building A. I'll position it roughly in the middle. I'm going to let this range be most of the building, although occasionally we get into a quiet spot up by the doors. That's pretty good, and I can see in this, pressing F to focus in, that there's actually a sphere with this audio. What this determines is our minimum distance, and then there's a maximum distance which is 500 units out. Very, very big.
What I'm going to do is size this down. Using that icon and clicking and dragging to affect the minimum distance. I'll make it bigger. So we definitely here when we're in this range. Then I'll pull max distance down. I'll try 50 to begin. And as we back out we can see that other sphere. It's still very big, it's a giant piece of audio and it will overwhelm everything. I'll pull this back further. I'll try 15 and now that outer range, the limit on this audio, encompasses this building.
There's a corner over here by the window that's definitely quiet. And, the opposite corner by the brick wall will definitely have sound. Once we get out onto the balcony, that sound really starts to fade out. And, this is a good place to be able to lap in to the audio from outside. Now, look at the volume. What happens here is that this sound is going to Play on Awake, meaning as soon as the game starts, play that sound. I'll leave that alone and check loop, and then scroll down to look at the 3D Sound settings. The 3D sound means that as I get closer or farther from the center of that sound, it comes and goes with a Doppler effect, meaning it starts off high and gets low as we away.
Down in this graph where I've got my logarithmic roll off set by default, I can see I've got volume keys for the sound. I'm going to take this all the way down at the end, so that by the time we exit the volume it's exactly quiet. Right now what this means is that I would always hear the sound in the game. Because the end key here still has a volume of about a third or so. I'll pull this down further, so that by the time we reach the end of that range that sound is really gone. It's important to think about, when do we hear the sound as well.
I'll alter the handles. And so now, when we're in that range, we definitely hear the sound. And as we get out to the outside, it fades to precisely zero. Sometimes, we want sound to always be there in the scene. For example, let's say we're running around a place with generators. Even at the farthest reach of the level, we may hear a gentle hum from the generators. And it turns into a roar when we get close. For other places we may want the sound to fall off exactly, so that when we're out on the balcony, we don't get the interior hum of the air conditioning.
I'll play this and see how it sounds, hopefully it'll be in the right range, and I'll still hear the sound nicely enough inside. Here I am in the game, and I can definitely hear that audio, the hum of the vents. As I move around, the sound changes, getting into that corner, and the game gets very quiet, it really recedes off, so I'm in a really still place. As I come back over, it picks up again. It's working nicely. I may end up wanting to take the volume down and I can do it here in this graph. Alternately I've got an overall volume for that sound.
I'll lower the overall volume just a bit and then I'll look at the priority. Priority goes between 0 and 255, with 0 being the highest. I'm going to pull this sound down, so it's got a higher priority. This way I'll always hear this hum. And it'll override other sounds that are occasional or triggered such as doors. Now I can clone this around. I'll press Ctrl+D, duplicate it, and slide it over into the next building, naming this one building B interior sound. Finally I'll duplicate it into building C.
Pressing Ctrl+D one more time, and pulling it over. Once I've got these in, I'm ready to get my lake sounds in. They'll use the same kind of audio source, with a much smaller range. So as we step out onto the balcony, I've got the sound of water around the base of the buildings.
Get unlimited access to all courses for just $25/month.Become a member
107 Video lessons · 33156 Viewers
94 Video lessons · 23002 Viewers
78 Video lessons · 9384 Viewers
147 Video lessons · 3130 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.