From the course: Cert Prep: Unity Certified Associate Game Developer Audio and Effects

Audio files: Music and SFX - Unity Tutorial

From the course: Cert Prep: Unity Certified Associate Game Developer Audio and Effects

Start my 1-month free trial

Audio files: Music and SFX

- [Instructor] In this chapter of the course, we'll be looking at the fundamentals of audio, sound effects and music here inside the Unity engine. It's a really important topic. So often it's easy to underestimate the impact that audio has inside a video game and to leave these things to the last minute when you're building your own games and you really mustn't do that. So let's check out Unity's really great audio feature set. To demonstrate this feature set, I'm going to be using this haunted house project. This is part of the John Lemon tutorial that is available completely free of charge from the Unity asset store. You don't need to download it from there because it's also included inside the course exercise files. But if you want to download these assets from the asset store, I'm going to bring up a web browser window. You can easily go to the Unity asset store, search for 3D beginner tutorial resource, and you can add that to your assets, importing that into your project. The details on how to download and import assets from the asset store is covered in an earlier module of the Unity certification courses here at LinkedIn Learning. I'm going to go back to Unity here and check out the project that I have put together using those assets and what you included inside the exercise files. By hitting play on the toolbar here, we have this character standing at the center of this gloomy bedroom, his knees knocking. He looks pretty afraid. Now I can move my mouse around the view here and click on the floor to move the character to the location that I clicked on. I can click over here and the character will walk to that location. I can even click on the other side of the bed and the character will walk over there too. We have this light flickering at the back here, and that's pretty much all there is to this scene. But this scene is completely devoid of music and sound effects that could really enhance the atmosphere. Now there are different ways that you can bring your own audio assets into the Unity engine. One of the ways is that you can bring in your own audio files just by dragging and dropping them down here into the project panel. It really is that simple. It's the same process for importing pretty much any kind of asset into Unity. We can also use the audio assets that are included inside this project, which is what I will be doing. But before I do that, I want to say a bit more about the types of audio assets that you can bring into your project here. To do this, I'm going to bring up the Unity documentation inside a web browser window. You can go to that link by docs.unity3d.com. It's inside the manual in the audio overview page. And inside that page, if you scroll further down to the working with audio assets section, you will find listed there a list of common audio formats, file types that you can bring into Unity, which encode audio. They are the .aiff format, the .wav format, the .mp3 format and the .ogg format, all of which you can drag and drop into Unity. In addition to that, you can also bring in these other slightly lesser known types of music files, but most commonly your audio assets will be in these formats. And among these formats, I recommend you use the .wav format wherever possible. It's a really great format that can be opened in so many different game engines and audio programs. It's such a common format that it's really easy to use. Now I'm going to go back to Unity, and I'm going to be searching the project panel here for the audio that we already have inside our project. By moving to the project panel and to the search field on the top right-hand side, I can search for any kind of asset by using a special command that works inside the project panel. To do that, I'm going to start by typing the letter T, T meaning type, and then after T, I'm going to press semi-colon, or colon, actually, beg your pardon, and that indicates that I'm searching for a particular kind of asset. After this, I want to specify the type of asset I'm searching for. For example, if I wanted to search for all the textures, I can just type "texture" and immediately I can see all the different textures I can use. But I don't want to search for textures. In this case, I want to search for audio clips. That's the name that Unity gives to audio assets. So I'm going to type "audio clip", and there we have a complete list of all the audio clips here inside this project. We also have available different assets here from the Unity asset store, 999 plus of them. We're not going to be using those. We're just going to be sticking here with the assets that are already inside the project. Now among these assets, we have different types of files. We have our music files, which are going to be longer tracks designed to play on a loop. And then we have sound effects, which we intend to play at particular times. You can see here in our list of assets, for example, if I select this one here, we have a game over asset. We have the footstep sounds, footsteps, that is, that should play when this character starts moving around. When I left-click to select an audio asset here inside the inspector, I can check out additional properties. On the bottom right-hand side, you're going to get the waveform here. So I'm looking at the actual wave data included inside that audio file. I can hit the play button on the preview bar to actually preview what that sounds like. And down here at the bottom, it tells me how long the track is, around about five seconds. And similar thing here, I can select this track here, the house ambience. This is a much longer track, like a music piece designed to play on a loop in the background to set the scene. In this case, you can check out the waveform here and see that the length of this file is about 34 seconds. You can also look at the file properties here. The original size for that file is about 5.8 megabytes. So these are the main properties of importing audio assets. In the next movie, we're going to look at distinguishing between the different types of audio assets, music, sound effects, just from the range that we've imported here. We're going to be checking out the different import settings that we should use for each and why we should do that.

Contents