How to add multiple sound effects in Unity (3 MINUTES) - Unity 2022 Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone we all know how important sound effects are in video games and if you think otherwise well just watch this footage of ori and the blind forest with and without sound effects [Music] change your mind yet all these little details and sound effects contribute a lot in the game's overall quality and how the players feel when playing it so with the intro out of the way be sure to like and subscribe to the channel and don't forget to hit the notifications bell and let's get on with the video [Music] alright so now we have three buttons right here these buttons represent different sounds i'm going to be playing three sounds and we'll make these sound effects well play so first of all we have three buttons right here each button should play a certain sound so how do we do this so what i'm gonna do is i'm gonna create an empty game object i'm going to call it src and i'm going to add an audio source object to this empty game object so it just has an audio source component it's literally just an audio source this is where the sound effects are going to come out from right so it's really easy to program this we'll just go to canvas or go to wherever your script is located and i'm going to create a new script i'm just going to call it sound effects player alright so now we have this sound effects player script right here we have the start function and the update function keep them if you want and just program in where you want the sound effects to play well we're dealing with buttons right here i'm going to make a public audio source object src i'm going to create another public audio clip object and i'm going to put in sfx1 sfx2 and sfx3 we have three audio clip objects right here so we have three different a audio clips in our script now you can call them whatever you want in a public void button one i'm gonna copy it and then make a button two script and a button three sorry button two function and a button three function perfect so when we press button one what do we want to do we want to call the src dot clip equals sfx one perfect and then ssrc dots play awesome now we want to do the same things right here so copy this paste this right here 2 sfx3 for the third sound effect awesome so what this will do is let's just go back so what this will do is that we're going to call the src object so we're going to put the audio source right here we're going to call it right here we're going to call this component the audio source component from the src game object we want to call it and we want to call the src dot clip this is the clip so when we call it we call src.clip what is clip this is the clip right here audio clip alright awesome now we have three different sound effects right here i just quickly downloaded them from sfxr and i'm going to go back to the script i'm going to add the sfx1 sfx2 and then i'm going to put in the sfx3 right here perfect we're just going to select all the buttons and then i'm going to put the canvas to all of them now i'm going to go to the first button i'm going to assign it as button one and assign the second one as button two and the third one as button three perfect now it should work now if we play if we click on the sound one sound two and then the sound three perfect they all work this was just a quick tutorial check out this video where i made a game about milk lasers in the cat that has gravity powers don't forget to like and subscribe or you can also check out this video if you want cheers [Music] you
Info
Channel: The Game Dev Show
Views: 67,402
Rating: undefined out of 5
Keywords: sound effects unity 2d, how to make sound effects for games, unity 2022, blackthornprod 2d movement, the game dev show, jonas trollyer, how to add sound effects, sound effects, unity, unity sound effect tutorial, 2022, dani, blackthornprod, game development for beginners, game development unity, indie game development, game development, unity 3d, unity3d, unity 2d tutorial, game making, adding sound effects to your game, add sound effects in 3 minutes, add sound effects simple
Id: mvaUho_a-q4
Channel Id: undefined
Length: 4min 9sec (249 seconds)
Published: Mon Feb 07 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.