Introduction to AUDIO in Unity

  Рет қаралды 1,037,177

Brackeys

Brackeys

Күн бұрын

Пікірлер: 1 700
@mr.mysteriousyt6118
@mr.mysteriousyt6118 7 жыл бұрын
don't stop teaching us.
@mertpolat8989
@mertpolat8989 7 жыл бұрын
please
@delberg585
@delberg585 6 жыл бұрын
wtf hhh heyyyy praying a long age for him
@fuggedaboutit3445
@fuggedaboutit3445 4 жыл бұрын
1000th Like
@raphaelrondeau1870
@raphaelrondeau1870 4 жыл бұрын
mr.MYSTERIOUS,YT, 2018 What a discourt
@shadowplayz7586
@shadowplayz7586 4 жыл бұрын
He is just awesome 😊😊😊
@TheGrimmGamer
@TheGrimmGamer 3 жыл бұрын
That feeling when you follow the tutorial, set everything up, tear your hair out for 3 hours wondering why the sound won't play... and then change the pitch from 0 to 1.
@stripeysoup
@stripeysoup 3 жыл бұрын
OMG THANK YOU.
@maxplayerone9565
@maxplayerone9565 3 жыл бұрын
The legend that saved me weeks of debuging- Grimm himself. Thanks dude!
@goodgamershow6505
@goodgamershow6505 3 жыл бұрын
@@maxplayerone9565 do we need to change [Range(0.1f, 3f)] of pitch variable to 1f,3f or what?
@goodusername4901
@goodusername4901 3 жыл бұрын
@@goodgamershow6505 i think you need to look at the Audio_Manager game object's script component
@persimmon93
@persimmon93 3 жыл бұрын
Your comment saved my hair. My hair thanks you.
@Joohyunsang
@Joohyunsang 3 жыл бұрын
This video is 4 years old, but it still legit!! I was struggling to find a way to manage game audio files until watching this. Many thanks to Brackeys!!
@LILMAN_official
@LILMAN_official 4 жыл бұрын
If you are new to coding and you arnt able to take classes I would suggest following along and paying attention with alot of beginner coding videos, it really does help, this channel its self is probably one of the best places to start.
@MT-nd5ut
@MT-nd5ut 2 жыл бұрын
For anyone that's struggling with ArgumentNullExceptions when you switch scenes, it's because you're referencing the wrong AudioManager. For example, if you switch scenes, the AudioManager in the scene gets destroyed by the singleton code, but you call Find() on it instead of the singleton instance of the AudioManager from a previous scene. In other words, you shouldn't use Find() but rather AudioManager.instance when referencing the AudioManager. In fact, if your game always starts at the main menu of your game then you only need one AudioManager instance in the main menu hierarchy, but I'd still recommend keeping AudioManagers in every scene.
@blenderian4152
@blenderian4152 Жыл бұрын
Thank you ❤️❤️
@youngag2710
@youngag2710 Жыл бұрын
omfg thank you so much bro
@In-N-Out333
@In-N-Out333 6 жыл бұрын
Move these two lines of code: s.source.volume = s.volume; s.source.pitch = s.pitch; from Awake to the Play function. That way you can adjust those values in real time while the game is running.
@skiesquiggles7319
@skiesquiggles7319 5 жыл бұрын
Brorger
@Diego0wnz
@Diego0wnz 5 жыл бұрын
How to control them all at once?
@DavidBixler
@DavidBixler 4 жыл бұрын
This doesn't work for me unfortunately.
@DavidBixler
@DavidBixler 4 жыл бұрын
So this works, except for the music. It doesn't seem to allow change at runtime for the currently playing sound.
@sumogre1822
@sumogre1822 4 жыл бұрын
@@DavidBixler How'd you do it?
@NewbNinjas
@NewbNinjas 2 жыл бұрын
OK Guys, for some of you that will likely be getting a Null:Exception Error you might need to check that you aren't trying to Play() the sound in an AWAKE function on another object. I had this problem and for about a month I've been pushing it to the side and figured I'd get around to fixing it later when it became a little more important. SO the problem I had was I used the same setup as in the tutorial, with another class I called Jukebox. This was to handle the current soundtrack playing and to allow players to cycle between other soundtracks in the game, like a Jukebox :D Long story short, I was calling the following lines of code: audioManager = FindObjectOfType(); audioManager.Play("music_metal_1"); within the Jukebox.Awake() function. This is a NO NO. The SOURCES aren't populated until later which means when I was trying to invoke them they hadn't actually been setup ;) To get around this I simply called the same code in the Jukebox.Start() function which worked absolutely fine. I hope this helps one other poor soul out there then I know my suffering was not in vain. This post isn't actively monitored so my query went almost 2 months without a single response. I hope this helps someone. Never Give Up
@Noobyoulus
@Noobyoulus 2 жыл бұрын
Thank you!!!
@TheBrunoRM
@TheBrunoRM Жыл бұрын
@@Noobyoulus So basically, only use Awake() to initialize the class that method is in, and use Start() to get references from other classes, making sure the other classes have already been initialized by the Awake method.
@aidan_byrne
@aidan_byrne 4 жыл бұрын
This is by far one of the most straightforward and easy to follow tutorials I have watched in quite a while!
@sampleMEGdoor
@sampleMEGdoor 8 ай бұрын
No it isnt
@sampleMEGdoor
@sampleMEGdoor 8 ай бұрын
Isn't****
@NightcoreMotion
@NightcoreMotion 7 жыл бұрын
If anyone is curious on how to stop playing a looping sound (maybe you want to switch bg music when you enter a new area) just use s.source.Stop (); You can just add a method to the Audio Manager like this public void StopPlaying (string sound) { Sound s = Array.Find(sounds, item => item.name == sound); if (s == null) { Debug.LogWarning("Sound: " + name + " not found!"); return; } s.source.volume = s.volume * (1f + UnityEngine.Random.Range(-s.volumeVariance / 2f, s.volumeVariance / 2f)); s.source.pitch = s.pitch * (1f + UnityEngine.Random.Range(-s.pitchVariance / 2f, s.pitchVariance / 2f)); s.source.Stop (); } just call it like this (AudioManagerReferenceGoeshere).StopPlaying("sound string name");
@arnedebeer
@arnedebeer 7 жыл бұрын
Hey Nightcore Motion, I was just like you using s.source.Stop(), but it keeps giving me a NullReferenceException that the source equals to null, any idea on how to fix that?
@SasukeUchiha723
@SasukeUchiha723 6 жыл бұрын
You should actually write it at the place where you want to stop bgm 1 and play bgm 2. if (blah blah){ FindObjectOfType ().StopPlaying ("GameplayMusic"); FindObjectOfType().Play("MenuMusic"); }
@ItsBenniiBoii
@ItsBenniiBoii 5 жыл бұрын
You sir, are a lifesaver!
@praveenkrishna8885
@praveenkrishna8885 5 жыл бұрын
I want to fade in the audio in start how to do that.
@kishiosakai2649
@kishiosakai2649 5 жыл бұрын
Wow thank you, I was trying for hours :D
@houssam3009
@houssam3009 3 жыл бұрын
The more I watch the more I miss you man thanks for all the awesome tutorials.
@imconfused6955
@imconfused6955 7 жыл бұрын
Is the audio just you making noises
@diegocrusius
@diegocrusius 7 жыл бұрын
preprocessing with what, please?
@diegocrusius
@diegocrusius 7 жыл бұрын
hmm I think I remember using audacity to cut and convert some audio files Didnt know you could go much further. Thanks.
@diegocrusius
@diegocrusius 7 жыл бұрын
thank you for your kindess
@Brackeys
@Brackeys 7 жыл бұрын
NO! ... Okay yeah :)
@chickentim8505
@chickentim8505 6 жыл бұрын
xD
@Junglej0hn
@Junglej0hn 6 жыл бұрын
Very nice solution, if I may add one thing then instead of finding the gameobject reference every time you want to play a sound, you could write a static function in the audiomanager: public static void PlaySoundStatic(string name) { if (instance == null) { Debug.Log("No audio manager "); return; } instance.PlaySound(name); } Then we use the current active audiomanager to play the sound. Then you would write "AudioManager.PlaySoundStatic(string mySoundName);" to play a sound from anywhere.
@guillaumemaille7592
@guillaumemaille7592 2 жыл бұрын
Thanks! This helped me!
@localSunMan
@localSunMan 7 жыл бұрын
Thank you a lot for this tutorial. I spent multiple days figuring out a way to keep the music nice and clean throughout scenes and after finding a somewhat working method, your tutorial is like a gift from the heavens (the internet heavens). Love your tutorials, love your good attitude, can't wait for the next one!
@samuelleigh2270
@samuelleigh2270 10 ай бұрын
Still using this 6 years later! Thanks!
@IdleGamer208
@IdleGamer208 10 ай бұрын
me too
@michaelanonymous3104
@michaelanonymous3104 4 ай бұрын
me too but.... "MissingReferenceException: The object of type 'AudioSource' has been destroyed but you are still trying to access it" and no I didn't alter the code
@tonihenriksson2399
@tonihenriksson2399 4 жыл бұрын
I have watched your videos for ages , learning a shit ton from them. I just realized i never thanked you for the videos. So.. THANK YOU! You are really motivating me through my struggles :D
@rigzmoviediaries654
@rigzmoviediaries654 5 жыл бұрын
Brackeys, without you I would be lost and stuck paying for a course. Thank you.
@fv4202x
@fv4202x 4 жыл бұрын
how are you now?
@rigzmoviediaries654
@rigzmoviediaries654 4 жыл бұрын
@@fv4202x My interest in game development has definitely decreased, but my skills and craft have definitely increased. I'm still planning on releasing games one day.
@artyWeeb
@artyWeeb 4 жыл бұрын
@@rigzmoviediaries654 good luck
@cheesedabber
@cheesedabber 3 жыл бұрын
@@rigzmoviediaries654 and how is that going for you now?
@marxiplier4322
@marxiplier4322 4 жыл бұрын
Finally, I've been looking at a bunch of overly complicated sound managers that I can't seem to get to work, and then you come along and make it so much simpler and actually work.
@Aessa7
@Aessa7 6 жыл бұрын
Dude I love your direct style, you don't waste ANY time, and you trust the viewer to understand. Thank you so much.
@codersexpo1580
@codersexpo1580 4 жыл бұрын
GREAT VIDEO! If I may add ... Since the audio "Name" is created when you add it to the Audio Manager, it might be best to add that name to the Audio Manager Enum. Like so... public enum AudioSounds { ShipEngineThruster = 0 , SomeOtherSoundName = 1, YetAnotherSountName = 2 } ...and then from any component using the Sound Manager that sound can be called by name like... audioManager.Play(AudioManager.AudioSounds.ShipEngineThruster); ...and in the Audio Manager's method to Play, we have... public void Play(AudioSounds name) { var s = FindAudioClip(name); if (s != null) { if (!s.source.isPlaying) { s.source.Play(); } } } private Sound FindAudioClip(AudioSounds name) { return Array.Find(sounds, sound => sound.name == Enum.GetName(typeof(AudioSounds), name)); } I hope you like this addition ;-) Love the work you do!!
@codersexpo1580
@codersexpo1580 4 жыл бұрын
I also wanted to just add, if folks are not familiar with what you were doing @13:10, this is called a singleton pattern (which I believe he mentions) and I would highly suggest anyone not familiar with this pattern to research it. In fact Jason W @ kzbin.info/www/bejne/noKoaZ-HoJ6coac does a nice job of discussing this pattern as well as a few others often used in development. Thanks again for an awesome video.
@ignatiusreilly8280
@ignatiusreilly8280 4 жыл бұрын
The visuals and lighting and smoke are awesome looking in that little game.
@nikitaprodanov5219
@nikitaprodanov5219 5 жыл бұрын
It`s amazing that there are still people like you who keep helping others without wanting something for exchange. Love your vids. I wish you luck and don`t stop making this awesome tutorials.
@mohamedhousain5656
@mohamedhousain5656 2 жыл бұрын
yea about that...
@gamerheroine
@gamerheroine 3 жыл бұрын
I've rewatched this video so many times! Its such a good resource. Everytime I get to doing audio in a game I pull this up again for a refresher.
@diegocrusius
@diegocrusius 7 жыл бұрын
if I could marry a youtube channel it would probably be this. One of the best Brackeys videos I saw so far.
@diegocrusius
@diegocrusius 7 жыл бұрын
everything I needed about audio to my game is in this video.
@razcuks1129
@razcuks1129 4 жыл бұрын
@@GGOOSEO LMAO 69
@spaghetti_bro3093
@spaghetti_bro3093 4 жыл бұрын
A not an
@diegocrusius
@diegocrusius 4 жыл бұрын
@@spaghetti_bro3093 thank you
@weluvsprxng
@weluvsprxng 4 жыл бұрын
@@diegocrusius wut
@hamez6970
@hamez6970 2 жыл бұрын
i love the way these guys made sounds, with their mouth
@RealRushinRussian
@RealRushinRussian 2 жыл бұрын
I don't understand. So you design a custom Sound class that has most of the core data that a stock AudioSource already has. You then make a messy, obscure Inspector interface to interact with it - I mean, try to remove or add a sound from/to the middle of the list and see how that works... Only to just copy all the custom Sound data fields into the hidden AudioSources on Awake. What is the point of all of this other than to make everything obscure and ridiculously difficult to maintain once you have more than 2-3 sounds? Make an empty object that contains an AudioSource. Make a prefab out of it. Add a prefab instance for every sound you want to have; name your objects accordingly in the hierarchy. Make them all children of an AudioManager object. Take the whole object (with all children) and save them as a prefab as well. Just add this prefab to every scene. To add a new sound, simply go to prefab-editing mode and do what you must. No restrictions on deleting, adding, or changing the order of your sounds. No need to duplicate the data between a custom class and an actual AudioSource. You could even have separate sound lists per scene which is also super easy to set up. There are probably far better approaches to this as well, but this one is a straight up mess. Don't make lists of custom classes that you fully set up from the Inspector. Either load the data from a file (json, csv etc) or set it up with objects but don't go for the Inspector approach. Just the fact that you can't modify the order of your sounds alone should ring alarm bells. So should the data-duplicating. It's not viable for anything beyond a simple test scene. Like, I get that it's supposed to be a lesson for beginners but it's still a horrible approach.
@cjplanes
@cjplanes 2 жыл бұрын
Goddamn you are a genius
@tegxi
@tegxi 2 жыл бұрын
I like your method, it seems far less janky. Though given that this tutorial is 5 years old your hostility seems excessive.
@Random_Coffee_Cup
@Random_Coffee_Cup 4 жыл бұрын
I noticed that the car did not destroyed when you go forward in one way haha and u said make thing like when player go in one way for some time respawn one ticket on his way! Don't stop man your videos is helping a lot
@shehzaanansari8204
@shehzaanansari8204 7 жыл бұрын
Great video as always!
@neptunesnep9458
@neptunesnep9458 5 жыл бұрын
Overwatch lets go brother
@razorNeel
@razorNeel 4 жыл бұрын
I started creating a game without having any c# knowledge last week based on your cube game. Now it has 7 proper levels, both keyboard and touch controls and a save file system.
@razorNeel
@razorNeel 4 жыл бұрын
And now it has sound as well
@gulraiz19
@gulraiz19 2 жыл бұрын
Move these two lines of code: s.source.volume = s.volume; s.source.pitch = s.pitch; in Update() function in the AudioManager Script. Like this: private void Update() { foreach (Sound s in sounds) { s.source.volume = s.volume; s.source.pitch = s.pitch; } } That way you can adjust those values in real time while the game is running.
@shadbh2
@shadbh2 2 жыл бұрын
genius
@umadkuzubad
@umadkuzubad 4 жыл бұрын
You are amazing! Years later and I'm still using your videos with great success. Thanks Brackeys.
@johncisors4832
@johncisors4832 7 жыл бұрын
Love your sound effects :D
@Brackeys
@Brackeys 7 жыл бұрын
Haha, thanks! :)
@dmitrij34
@dmitrij34 7 жыл бұрын
+Brackeys Why Array.Find? Why not a dictionary with try get value instead?
@sfaezamin
@sfaezamin 5 жыл бұрын
Its just his voice
@place_holder2160
@place_holder2160 3 жыл бұрын
@@sfaezamin no shit sherlock
@tahahusain7328
@tahahusain7328 4 жыл бұрын
Please Don't Stop Teaching Us Unity, We All Love You And Your Tutorial's. Thanks For Teaching Us Unity For Free
@lunarfoxgames
@lunarfoxgames 3 жыл бұрын
Anybody watching this now who doesn't want to mess around with the pitch each time, just change this in Sound.cs: public float pitch = 1f; This will default the pitch in the inspector to 1, that way you don't need to manually do it each time. You can also make the volume at a default like this.
@Ajaxlancer
@Ajaxlancer 3 жыл бұрын
Would you know how this would manage a PlayOneShot function? For instance, I have a gun that fires automatically and I don't want the sound to cut itself off without playing the full firearm sound effect.
@pedrosalaspinero7220
@pedrosalaspinero7220 4 жыл бұрын
YOU RESCUED ME FOR MY FIRST GAME JAM LOVE YOU FOREVER
@jasonallen2602
@jasonallen2602 2 жыл бұрын
MAKE SURE you give the pitch a value that is NOT zero. Spent hours trying to figure out why my audio wasn't playing and realized it was because I never touched the pitch value and because it defaults to zero you get no sound.
@T-One_Entertainment
@T-One_Entertainment Жыл бұрын
Thank you...This was my exact issue
@user-account-not-found
@user-account-not-found 6 ай бұрын
This!☝
@SuperDutchrutter
@SuperDutchrutter 3 жыл бұрын
So useful. Going to miss the new uploads but hope your new adventures suit you well.
@shreddernation1096
@shreddernation1096 5 жыл бұрын
My dude made a game about king Kai’s planet 😂😂 great vid man!
@GerGauss
@GerGauss 3 жыл бұрын
This video has just saved me. I have been struggling for a week with this issue, I should have known better and have come here earlier
@BestJohnEver
@BestJohnEver 7 жыл бұрын
You rock man! Great programer, very organized and well explained! Thank you and never stop doing this videos!
@rastarish3201
@rastarish3201 7 жыл бұрын
Quite possibly, one of the most useful Unity tutorials I have ever come across! Thanks Brackeys!
@IronDizaster
@IronDizaster 6 жыл бұрын
*you know, coding is easier than you think.*
@synthjc5105
@synthjc5105 5 жыл бұрын
You Know You ShOuLd TaKe ThIs OnlNe UniTy On UnEdEmy
@shk_
@shk_ 5 жыл бұрын
@liberP lovPrimeNumbers YoU KnOw YoU dO
@Ab-gj1jw
@Ab-gj1jw 4 жыл бұрын
You know, coding is easier than you think when you just copy.
@apainush9540
@apainush9540 4 жыл бұрын
change my mind
@TGR-ll8mc
@TGR-ll8mc 4 жыл бұрын
@@synthjc5105 fucking hate that ad
@stevanivanovic9579
@stevanivanovic9579 2 жыл бұрын
Love the car voiceover work
@TigaLionessArt
@TigaLionessArt 4 жыл бұрын
Okay, so I know this video is like a thousand years old and probably nobody will help me, but I did this tutorial (with success) on one of my projects in Unity 2018.4.10f and it worked. Now I'm doing the exact same thing in 2019.3.0f5 and it's not working at all. After hitting play the Audio Source is created for a sound I add in AudioManager, it has the proper amount of volume and it's not playing. When I manually add an Audio Source on some other object (like Brackeys did in the beginning of the video) it works and the sound is played properly. Can it be the fault of the Unity version, or am I just doing something wrong?
@sulkingcrow7426
@sulkingcrow7426 4 жыл бұрын
I'm not sure if this is still relevant but I had the same problem and had to set the pitch to 1
@TigaLionessArt
@TigaLionessArt 4 жыл бұрын
@@sulkingcrow7426 Yeah I figured it out a day later. The script had mininal value of pitch set to 0.1, but it was written .1 so I had missed the fact it's not 1. And Unity treats any value of pitch under 1 as if it was set to 0. But anyway, maybe someone will have a similar problem and get to learn quicker what was wrong, than I did ;)
@SillyCraftersOcCheng2000
@SillyCraftersOcCheng2000 4 жыл бұрын
@@TigaLionessArt Thank god i see the comments here so can finish my game devoloping project for uni
@jhgfghjfuzrtfchchghgf
@jhgfghjfuzrtfchchghgf 4 жыл бұрын
@@sulkingcrow7426 thanks for posting this! I was trying to get this to work for over an hour. this tutorial is broken :(
@sulkingcrow7426
@sulkingcrow7426 4 жыл бұрын
@@jhgfghjfuzrtfchchghgf no problem! And it was a great tutorial, just a small (but important) part got looked over
@mohammedzaidkhan5687
@mohammedzaidkhan5687 3 жыл бұрын
The only tutorial I didn't understand by brackeys
@AboA7ma11
@AboA7ma11 4 жыл бұрын
Use this function to adjust volume in runtime public void adjustvolume(float volume, string name) { sounds s = Array.Find(sounds, sound => sound.name == name); s.source.volume = volume; }
@AboA7ma11
@AboA7ma11 4 жыл бұрын
@@flaymes make sure the other class name is "sounds"
@AboA7ma11
@AboA7ma11 4 жыл бұрын
@@flaymes do adjustvolume("musicname", Slider.value);
@ptaroworm7887
@ptaroworm7887 3 жыл бұрын
Dude, you're a life saver. This is exactly what I was looking for. Thank you
@Somewhere_sometime_somehow
@Somewhere_sometime_somehow 2 жыл бұрын
@@AboA7ma11 I wanna use this but I'm stupid. What other class do you mean. You add this to the audiomanager right? I do have an array called sounds[ ] in my AudioManager script?
@AboA7ma11
@AboA7ma11 2 жыл бұрын
@@Somewhere_sometime_somehow yeah just paste this into your audio manger as a method and use it as any other method in your script. just make sure when you call it you input a value or a variable as your volume :D
@oxenfree6192
@oxenfree6192 5 жыл бұрын
You're an amazing instructor. Please never stop. Your videos are so clean and direct, and you cover information so well.
@Soryn_Clark
@Soryn_Clark Жыл бұрын
That didn't age well lol
@turkym7md5
@turkym7md5 6 жыл бұрын
1:36 i could say that you stick your mouth on the microphone and say "phooooophooooooophoooooo" xD
@jroenning
@jroenning 4 жыл бұрын
all your videos are just so easy to use and straight to the point thank you so much
@diablo4ever868
@diablo4ever868 3 жыл бұрын
does anyone have a link to the audio manager download? looks like the link in the video is broken
@DaMaLZ
@DaMaLZ 3 жыл бұрын
same
@afrorecording
@afrorecording 2 жыл бұрын
@@DaMaLZ actually it works hahah
@skyacaniadev2229
@skyacaniadev2229 6 жыл бұрын
Those lovely mouth-crafted audio clips...
@nonnodacciaio704
@nonnodacciaio704 7 жыл бұрын
What if I want to stop the theme music, for example when Player dies?
@Yar3920
@Yar3920 6 жыл бұрын
Nonno d' acciaio then destroy the audio manager
@JasonEkonomakos
@JasonEkonomakos 6 жыл бұрын
No, don't destroy the audio manager, why would he do that? Simply call the music using the audio manager and either pause it or stop it
@dadmanful
@dadmanful 6 жыл бұрын
lol
@zoewalker2064
@zoewalker2064 6 жыл бұрын
@@JasonEkonomakos how tho???
@JasonEkonomakos
@JasonEkonomakos 6 жыл бұрын
@@zoewalker2064 I have a different set up for my audio manager, but, looking back at this video, notice how he sets up the Play function. In the audio manager, Play takes a string input and finds the audio file with that name. The quickest solution to your problem is simply copy and paste the Play function, rename it Pause, and instead of writing "s.source.Play()" write "s.source.Pause()". Then when you want to pause a sound, just call the audio managers pause function and pass the audio files name as the input
@DarthJeremy364
@DarthJeremy364 3 жыл бұрын
i miss you brackeys
@taragitaratayo2304
@taragitaratayo2304 6 жыл бұрын
Hey man! quick question, I've succesfully added the Audio manager , problem occurs when i try to combine the adding settings and slider control / mixer in my game . since yours creates a a new component .. how would i go about adding the mixer source on the component via script. Many thanks!
@Averysh
@Averysh 5 жыл бұрын
Did anyone figure this out yet?
@kingdavegamess
@kingdavegamess 5 жыл бұрын
@@Averysh if you did the "Introduction to AUDIO in Unity" you need to add another component to the Audio Manager and Sound Class . in the Audio Manager : s.source.outputAudioMixerGroup = s.group; in the Sound : public AudioMixerGroup group; and then add in the group : "Master(MainMixer)" I did so and it worked ,hope it helps .
@serbaneduard5045
@serbaneduard5045 4 жыл бұрын
@@kingdavegamess thx. You help me a lot.
@kingdavegamess
@kingdavegamess 4 жыл бұрын
@@serbaneduard5045 no problem
@isaialusuardi
@isaialusuardi 4 жыл бұрын
@@kingdavegamess Thx it works!!!!
@Toopa88
@Toopa88 4 жыл бұрын
The Sound class can be changed to a ScriptableObject in literally one minute. All you have to do is derive from ScriptableObject and add this: _[CreateAssetMenu(fileName = "sound_name", menuName = "ScriptableObjects/Sound")]_ above the class name. Then you can create new Sound objects, define the values and drag all of them into the AudioManager in one go. Furthermore, your sound-settings will be saved at an actual place, which is a huge benefit. PS: as this will delete your previously defined values, you should make a screenshot of them to not lose time.
@ARTHUR14523
@ARTHUR14523 4 жыл бұрын
Now how do we play these sounds from the Master mix that we made in your other video so we can decrease volume from the slider?
@waterandtreefilms
@waterandtreefilms 7 жыл бұрын
MY GOD!!!! Your tutorials have come a long long way! i think you have cracked the key to making the best tutorials. Fast but explanatory. New Fav GameDev Channel
@SpeedySpee
@SpeedySpee 6 жыл бұрын
If you are still looking to download and the link doesn't work! Use this link. old.brackeys.com/wp-content/FilesForDownload/AudioManager.zip
@Liam-uf9og
@Liam-uf9og 6 жыл бұрын
thank you so much
@vishnughosh2895
@vishnughosh2895 6 жыл бұрын
Thanks a lot
@trixygames7705
@trixygames7705 Жыл бұрын
legend
@sumitgohil2636
@sumitgohil2636 7 жыл бұрын
You're one of the best online tutor I've came across. There's a lot to learn from you. Please don't stop teaching and keep doing this wonderful deed. God Bless You.
@zacharyseebeck2409
@zacharyseebeck2409 7 жыл бұрын
I can't get any sound to come through. Even when directly copying and using your script. I can run the code with no error, but no sound either.
@ferguslees7994
@ferguslees7994 7 жыл бұрын
Got the same issue here, appears in the audio manager but does not play...
@jeroeno_boy149
@jeroeno_boy149 6 жыл бұрын
same
@Shavinderyt
@Shavinderyt 6 жыл бұрын
late reply, but for other people, make sure your pitch is above 0. 1 is the normal sound without any pitch changes. and volume needs to be up too! this worked for me
@DarthZmex
@DarthZmex 6 жыл бұрын
Was working until I set it as a prefab, then even trying again from the begining it didn't work, the pitch is well set also
@jeroeno_boy149
@jeroeno_boy149 6 жыл бұрын
try design your own, worked for me
@user-account-not-found
@user-account-not-found 6 ай бұрын
A few improvements here would be to move the audio name to use an enum, the other part would be to trigger these based on state events rather than referencing and calling the audio manager itself.
@Dezmondo777
@Dezmondo777 7 жыл бұрын
The link to Audio Manager is not available anymore :((
@jeroeno_boy149
@jeroeno_boy149 6 жыл бұрын
old.brackeys.com/wp-content/FilesForDownload/AudioManager.zip
@seifmustafa2004
@seifmustafa2004 6 жыл бұрын
thanks mate :)
@MINTYBIBI
@MINTYBIBI 5 жыл бұрын
@@jeroeno_boy149 thx u so much
@DexterCrappell
@DexterCrappell 9 ай бұрын
ik, and it hurts cuz i need it to find my issues. I CANT FIND ANOTHER VIDEO THAT SHOWS MY FKN PROBLEM!@!!!@@!@@!@!@!!!!@@!
@pranavakp9960
@pranavakp9960 4 жыл бұрын
You are the best teacher for coding games!!!
@maxageev3dart
@maxageev3dart 4 жыл бұрын
How to adjust volume witch a slider in this AudioManager? Tried to add a new method for this but its dose not appears in functions while referencing AudioManager in a slider. public void AdjustVolume(float volume, string sound) { Sound s = Array.Find(sounds, item => item.name == sound); s.source.volume = volume; } How to make it work, please help ?
@sean6269
@sean6269 3 жыл бұрын
Did you ever figure it out?
@maxageev3dart
@maxageev3dart 3 жыл бұрын
Sorry man. Don't remember. That's was almost a year ago.(( I already probably lost the project where was using this thing.
@sean6269
@sean6269 3 жыл бұрын
@@maxageev3dart I got it ;) he made another video on an options menu that was pretty similar to what I was trying to do
@ravestechworld6445
@ravestechworld6445 4 жыл бұрын
Thank you soooo much bracks you have no idea how many people have you helped!
@deaf_conformist
@deaf_conformist 4 жыл бұрын
Sorry, when I heard the first sound of the car, I had to stop the video, I couldn't stop laughing ... I was like "ok, it is going to show us a professional car sound, recorded with a good mic ...." and suddenly ... "fffrrruuuuuummmmMMM"
@wmka
@wmka 2 жыл бұрын
searched for " using audio unity " thank you and have a good one
@gdzantaf6144
@gdzantaf6144 5 жыл бұрын
is there a way to cancel sounds(like music) by having some kind of stop method?
@gdzantaf6144
@gdzantaf6144 5 жыл бұрын
@@kadir9629 Thx
@vrstepper1204
@vrstepper1204 3 жыл бұрын
@@gdzantaf6144 StopMusic.cs(10,19): error CS0103: The name 'Array' does not exist in the current context.
@khnuxsora
@khnuxsora 2 жыл бұрын
@@gdzantaf6144 can you tell me how you did it?
@dartutorials7859
@dartutorials7859 4 жыл бұрын
if you cant hear sound in unity you might have to go into project settings - audio and uncheck "mute audio" or set master volume to 1 or in your game view at the top bar uncheck mute audio
@BlaZeLiink
@BlaZeLiink 7 жыл бұрын
Could you make a video about handling animation? For example: Weaponswitching in a fps You got an animation for putting down the current weapon. You also got an animation to pull out the second weapon. I implemented it one way, but it's not clean. I implemented a class, which starts a couroutine, which sets a bool in the animator of my current weapon, waits a second so it's finished, and then plays the next animation. I saw a lot of "tutorials" which try to create an animator-script. I don't think this apporach is good either.
@tudordumitrescu8707
@tudordumitrescu8707 7 жыл бұрын
DerLink he literally did a vid a week ago on this
@BlaZeLiink
@BlaZeLiink 7 жыл бұрын
if you refer to his weapon switching tutorial, that's not what I meant (not quite) I meant a tutorial about how to handle animation, I. e. import from a blend file, using mecanim. Like, wait for animations to finish using couroutines, implement clean animation transitions, the best way to implement animator controllers with blend trees, etc...
@jrgen7527
@jrgen7527 6 жыл бұрын
I think maybe you should look into state machines @DerLink
@fateshow5303
@fateshow5303 4 жыл бұрын
This is the only video that I've found that has successfully worked for me. Thank you!
@Kaikaku
@Kaikaku 7 жыл бұрын
Good timing, so far I have no audio in my program. This will now change :)
@KaiBeatbox0803
@KaiBeatbox0803 4 жыл бұрын
damn I really like the way the Brackeys always give us the whole script and also teach us how to script yourself at the same time.
@LRMTB
@LRMTB 4 жыл бұрын
i know this vid is quite old so probs no one will help, but how do you make it so that the music continues through the levels???? whenever i start a new level it starts the music from the beginning.
@shacharrodrigez7521
@shacharrodrigez7521 4 жыл бұрын
just make the music go again when the scene open
@LRMTB
@LRMTB 4 жыл бұрын
@@shacharrodrigez7521 yh the thing is i want it to continue from where it left off in the last scene
@cearaj405
@cearaj405 4 жыл бұрын
idk if you already found it out but just watch everything after 12:11
@LRMTB
@LRMTB 4 жыл бұрын
@@cearaj405 ah ok thanks lol
@micnasr
@micnasr Жыл бұрын
4 years later and I am still using the same Audio Manager that I used in 2019 lol
@Retr-eo5uz
@Retr-eo5uz 7 жыл бұрын
You're the best !
@peliculano
@peliculano 6 жыл бұрын
Yes he is!
@ludicrouS_406
@ludicrouS_406 4 жыл бұрын
Oh yeah, oh yeah!
@carlossierra1988
@carlossierra1988 7 жыл бұрын
this new thumbnail style looks great
@animemotivasiofficial
@animemotivasiofficial 2 жыл бұрын
if your voice doesn't sound(Maybe because of different version), add code, s.source.Play() foreach(sounds in sounds) { s.source = gameObject.AddComponent(); s.source.clip = s.clip; s.source.Play(); (Add This Code) s.source.volume = s.volume; s.source.pitch = s.pitch; } Hope you can help
@mariothelongtongue4657
@mariothelongtongue4657 2 жыл бұрын
THANK YOU
@ThatAlx
@ThatAlx 4 жыл бұрын
brackeys is the best coder ever keep it UP
@gaweringo
@gaweringo 7 жыл бұрын
am am trying to implement sounds into my games since 2 months, but unity is somehow not playing any of my audio files. Does anyone have an idea on how ti fix this problem?
@SasukeUchiha723
@SasukeUchiha723 7 жыл бұрын
im having the same issue
@Axedogames
@Axedogames 7 жыл бұрын
Have you the volume option at maximum ? Is unity no muted in your Volume mixer ?
@Axedogames
@Axedogames 7 жыл бұрын
Is your AudioSource near an AudioListenner ?
@d1nkum340
@d1nkum340 4 жыл бұрын
check the mute audio button isnt checked, its next to gizmos
@nextcent
@nextcent 4 жыл бұрын
Fantastic tutorial! So useful! I had a problem in the Singleton code, because we had a "return" there, the sounds array was not being processed when the game went from level 1 to level 2 and I was getting a null reference error. I removed the "return" and everything worked fine. Thank you for sharing this.
@affe7130
@affe7130 6 жыл бұрын
How would I go about adding volume sliders to some of the sounds in my AudioManager?
@train_guy
@train_guy 4 жыл бұрын
Check out Brackeys How to Make a Settings Menu in Unity Video and he explains how you can make an options menu and change the value of the volume kzbin.info/www/bejne/j4DEioSog5aij7M
@brycebishop186
@brycebishop186 6 жыл бұрын
You are the god of game development tutorials oh my damn
@Red_Dead_Chris
@Red_Dead_Chris 6 жыл бұрын
The link for the download do not work anymore :(
@VirtualTurtleGames
@VirtualTurtleGames 7 жыл бұрын
It's amazing how by watching these videos I learn about how little I know of coding. I love that feeling because it means there is so much more to learn! Thanks for the videos ":D
@CeretPenyok
@CeretPenyok 7 жыл бұрын
I can't hear the sounds when the object instantiated.
@benbuehler4972
@benbuehler4972 5 жыл бұрын
pitch needs to be at least .1f for sound to be made.
@maiskorrel
@maiskorrel 5 жыл бұрын
@@benbuehler4972 Thanks!
@TheNamelessTO
@TheNamelessTO 4 жыл бұрын
@@benbuehler4972 Thank you!!
@cerisskies
@cerisskies 4 жыл бұрын
@@benbuehler4972 Life saver, I've been going mad here
@spacedog2980
@spacedog2980 3 жыл бұрын
@@benbuehler4972 thank you legend
@ioverexcitedninja4281
@ioverexcitedninja4281 Жыл бұрын
Your tutorials are by far the best i could find out there 👍
@AlineoRykkeErrel
@AlineoRykkeErrel 6 жыл бұрын
In case you want to make a transition between two musics when you start another one, I made two coroutine to do that ;) the old music fade and the new one start progressively at the same time private Sound sound; public void Play(string name) { StopAllCoroutines(); if (sound != null) StartCoroutine(EndSound()); sound = Array.Find(sounds, s => s.name == name); if (sound == null) { Debug.LogWarning("Music " + name + " not found."); return; } StartCoroutine(StartSound()); } private IEnumerator EndSound() { AudioSource oldSound = sound.source; while (oldSound.volume > 0) { oldSound.volume -= 0.01f; yield return null; } oldSound.Stop(); } private IEnumerator StartSound() { sound.source.Play(); float volume = 0f; do { sound.source.volume = volume; volume += 0.01f; yield return null; } while (sound.source.volume
@Viralfanatics
@Viralfanatics 3 жыл бұрын
Idk if you'd see this or reply but what is old sound here. I am a beginner so I can't really understand that.
@AlineoRykkeErrel
@AlineoRykkeErrel 3 жыл бұрын
@@Viralfanatics Hey, oldSound is a copy of the music currently playing. This way, I can have the "old" music playing with the new one at the same time. And I can fade out the old sound to a volume of 0 and stop it to make a smooth transition between the 2 musics
@Viralfanatics
@Viralfanatics 3 жыл бұрын
@@AlineoRykkeErrel Oh Thanks. I want my music to fade out as I change scenes and in the next one I want another track to fade in. I have been trying to figure it out for hours now and I haven't been successfull yet :') Can you help me with that?
@Viralfanatics
@Viralfanatics 3 жыл бұрын
Nevermind. I figured it out. Thanks a ton. Your comment helped a lot!!
@AlineoRykkeErrel
@AlineoRykkeErrel 3 жыл бұрын
@@Viralfanatics you're welcome haha, did you use DontDestroyOnLoad?
@ishaanchauhan3169
@ishaanchauhan3169 7 жыл бұрын
i love how you are going over each topic. thank u sm
@AlexVoxel
@AlexVoxel 7 жыл бұрын
Nice sound effects
@Vero2726-s8u
@Vero2726-s8u 2 жыл бұрын
This is such a nice video, I'm starting with Unity now so I dint get much of the code part but I can see how great the Audio Manager is. Thank you so much !
@rickschroevers2497
@rickschroevers2497 5 жыл бұрын
In some scenes i want the music to stop using a trigger but i dont really know how to do that. Is there a way to have some kind of 'Cancelmusic' method that will pause certain sounds? If someone could just type a bit of code under this comment that would be awesome! 😄
@hajperdev
@hajperdev 4 жыл бұрын
public void StopPlaying(string sound){ Sound s = Array.Find(sounds, item => item.name == sound); if (s == null){ Debug.LogWarning("Sound: " + name + " not found!"); return; } s.source.volume = s.volume * (1f + UnityEngine.Random.Range(-s.volumeVariance / 2f, s.volumeVariance / 2f)); s.source.pitch = s.pitch * (1f + UnityEngine.Random.Range(-s.pitchVariance / 2f, s.pitchVariance / 2f)); s.source.Stop (); }
@hajperdev
@hajperdev 4 жыл бұрын
Somebody posted it there, it's the same but you just stop instead of play
@vrstepper1204
@vrstepper1204 3 жыл бұрын
@@hajperdev StopMusic.cs(10,19): error CS0103: The name 'Array' does not exist in the current context \StopMusic.cs(10,30): error CS0103: The name 'sounds' does not exist in the current context Cant get this to work at all. I dont understand why : AudioManager.instance.Stop("Smile"); does not work when: AudioManager.instance.Play("Smile"); works...
@hajperdev
@hajperdev 3 жыл бұрын
@@vrstepper1204 weird, I dont really remember how I made all of this but for modifying arrays im pretty sure you need to be using System libraries
@vrstepper1204
@vrstepper1204 3 жыл бұрын
@@hajperdev problem is that you guys can code and we can not. So when nobody specifies that this code need to go into the SoundManager and not anywhere else, we get lost. I solved it by piecing things together and going through everything again. But it is often we newbies get confused because the well-meaning pro skips step that is second nature to them :)
@developerssite9923
@developerssite9923 4 жыл бұрын
Brackeys is THE BESTTTTTTTTTTTTTTTTTTT!!!!!!!!!!!!!!!!!!!!! You had inspired me to make a game and now it will be available in sometime:)
@iZemash
@iZemash 6 жыл бұрын
Hi there everyone, I know that this is an old video, but what if I wanted to make a slider to control the volume if I made a settings menu. is there any way that I can hook this audio manager to an audio mixer?
@ms-9
@ms-9 6 жыл бұрын
same
@ms-9
@ms-9 6 жыл бұрын
okay I found a way : add : public AudioMixerGroup audioMixer; right before public Sound[] sounds; add : s.source.outputAudioMixerGroup = audioMixer; under the other s.source (volume, pitch, etc) assign your Master from the MainMixer in the editor and you're good !
@taragitaratayo2304
@taragitaratayo2304 6 жыл бұрын
Mano you are the champ! , would you happen to know how we can seperate the sounds into specifics , like fx , bg music etc , im thinking to create 3 sets of audio manager but that would be prolly a waste of code
@ms-9
@ms-9 6 жыл бұрын
Mikhail Opulencia you have to learn how the mixer works to do this. After looking this tutorial kzbin.info/www/bejne/rIDEgqNorZKcpZI you should be able to do it (I managed to create a fx volume slider and a music volume slider after this).
@ms-9
@ms-9 6 жыл бұрын
Well knowing how the mixer works was not enough I had to do some c# research you'll find
@milomakesstuff2019
@milomakesstuff2019 4 жыл бұрын
Thank you! It's working in my VR demo! You can here a hit sound now when you hit an enemy with your sword
@Ben-qn3py
@Ben-qn3py 5 жыл бұрын
I can Play music but I can't stop it. How do i do that?
@GeorgeWulfers_88
@GeorgeWulfers_88 4 жыл бұрын
You would need to call Stop() on the audio clip.
@vrstepper1204
@vrstepper1204 3 жыл бұрын
@@GeorgeWulfers_88 how please? AudioManager.instance.Stop("MyMusic"); does not work.
@bruceb85
@bruceb85 2 жыл бұрын
I feel like every high paying developer job expects a guy like brackeys that can actually code like this.
@omgtntlol
@omgtntlol 5 жыл бұрын
0:37 for some reason I heard "Lets add some silence" XDXDXD
@marcuionut6319
@marcuionut6319 3 жыл бұрын
if I think about "Lets add some silence", I hear "Lets add some silence" but if I think about "Lets add some sounds", I hear "Lets add some sounds" Black magic
@GoldenD60
@GoldenD60 4 жыл бұрын
TIMESTAMPS: Audio in Unity: 0026 Audio Manager: 04:01
@WhimsyCottage
@WhimsyCottage 4 жыл бұрын
Did you get the script to work?
@ahmedsleem81
@ahmedsleem81 5 жыл бұрын
Thanks, but the link to Audio Manager is dead now
@fulgencejuniorlohore854
@fulgencejuniorlohore854 3 жыл бұрын
You help me out buddy!!! Thanks for this tutorial! The Audio Manager is really useful!
@dcry1003
@dcry1003 3 жыл бұрын
hey just wanna ask how come i cant edit my audio in my audio manager when i created a new clip inside of it with the audio put in it i cant edit the audio i can only edit the audio it its respective gameobject
@fulgencejuniorlohore854
@fulgencejuniorlohore854 3 жыл бұрын
@@dcry1003 I got the same problem too. Even if the idea of creating an audio manager is cool, don't forget that since this tutorial has been done unity has undergone many updates. The problem comes from the output. Right that you a new audio clip but if the output is not configured, you wont got any sound. To solve this I did this: -Go to Window-Audio and Add "AudioMixer". From the AudioMixer window(upper right corner) you should see "Exposed parameters" hover it and read the text to know what it means. -In your Sound.cs do this: add "public AudioMixerGroup output;" as variable. -In your AudioManager.cs: add"s.source.outputAudioMixerGroup = s.output;" to the for each loop that go through your "public Sound[] sounds". if you want to play your audio from the AudioManager(disable your game object that holds your audio clip to make sure that it works and add your audio to the AudioManager) then do as he did in the video, like this: void Start() { Play("arion"); } of course in AudioManager.cs. -Then in your "Assets" folder you should see some thing like "Master" that was not there. Drag it to your AudiManager output. Adjust pitch to at least 1, adjust volume and enter game mode to see how it works. But you should watch Brakeys tuto on how to create "settings" in games.
@dcry1003
@dcry1003 3 жыл бұрын
@@fulgencejuniorlohore854 thats gonna be pretty hard specially if im gonna disable my gameobject just to test if the audio clip would work since some of those clips are from my player gameobject like death sound, jump, dash, attack, etc. Maybe like create a empty gameobject put the audio clips there and parent it to the player gameobject maybe that could work?
POWER UPS in Unity
10:54
Brackeys
Рет қаралды 306 М.
I Made the Same Game in 8 Engines
12:34
Emeral
Рет қаралды 4,3 МЛН
Как Ходили родители в ШКОЛУ!
0:49
Family Box
Рет қаралды 2,3 МЛН
БОЙКАЛАР| bayGUYS | 27 шығарылым
28:49
bayGUYS
Рет қаралды 1,1 МЛН
Хаги Ваги говорит разными голосами
0:22
Фани Хани
Рет қаралды 2,2 МЛН
How To Add Sound Effects the RIGHT Way | Unity Tutorial
15:21
Sasquatch B Studios
Рет қаралды 48 М.
How Do Game Devs NOT Overscope??
9:04
Green Light Dev
Рет қаралды 10 М.
How Games Have Worked for 30 Years to Do Less Work
23:40
SimonDev
Рет қаралды 1,4 МЛН
HOW TO PLAYTEST!
11:15
Brackeys
Рет қаралды 221 М.
Expert shows how AI will escape and kill us.
14:46
Digital Engine
Рет қаралды 214 М.
How Two People Created Gaming’s Most Complex Simulation System
38:54
ThatGuyGlen
Рет қаралды 1,5 МЛН
I Made My First Game in Godot in 3 Weeks...
26:21
Jack Sather
Рет қаралды 462 М.
How to MAKE YOUR GAME LOOK GOOD!
13:02
Brackeys
Рет қаралды 601 М.
every step to actually make your dream game (then sell it)
24:27