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.
@stripeysoup3 жыл бұрын
OMG THANK YOU.
@maxplayerone95653 жыл бұрын
The legend that saved me weeks of debuging- Grimm himself. Thanks dude!
@goodgamershow65053 жыл бұрын
@@maxplayerone9565 do we need to change [Range(0.1f, 3f)] of pitch variable to 1f,3f or what?
@goodusername49013 жыл бұрын
@@goodgamershow6505 i think you need to look at the Audio_Manager game object's script component
@persimmon933 жыл бұрын
Your comment saved my hair. My hair thanks you.
@Joohyunsang3 жыл бұрын
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_official4 жыл бұрын
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-nd5ut2 жыл бұрын
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 Жыл бұрын
Thank you ❤️❤️
@youngag2710 Жыл бұрын
omfg thank you so much bro
@In-N-Out3336 жыл бұрын
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.
@skiesquiggles73195 жыл бұрын
Brorger
@Diego0wnz5 жыл бұрын
How to control them all at once?
@DavidBixler4 жыл бұрын
This doesn't work for me unfortunately.
@DavidBixler4 жыл бұрын
So this works, except for the music. It doesn't seem to allow change at runtime for the currently playing sound.
@sumogre18224 жыл бұрын
@@DavidBixler How'd you do it?
@NewbNinjas2 жыл бұрын
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
@Noobyoulus2 жыл бұрын
Thank you!!!
@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_byrne4 жыл бұрын
This is by far one of the most straightforward and easy to follow tutorials I have watched in quite a while!
@sampleMEGdoor8 ай бұрын
No it isnt
@sampleMEGdoor8 ай бұрын
Isn't****
@NightcoreMotion7 жыл бұрын
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");
@arnedebeer7 жыл бұрын
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?
@SasukeUchiha7236 жыл бұрын
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"); }
@ItsBenniiBoii5 жыл бұрын
You sir, are a lifesaver!
@praveenkrishna88855 жыл бұрын
I want to fade in the audio in start how to do that.
@kishiosakai26495 жыл бұрын
Wow thank you, I was trying for hours :D
@houssam30093 жыл бұрын
The more I watch the more I miss you man thanks for all the awesome tutorials.
@imconfused69557 жыл бұрын
Is the audio just you making noises
@diegocrusius7 жыл бұрын
preprocessing with what, please?
@diegocrusius7 жыл бұрын
hmm I think I remember using audacity to cut and convert some audio files Didnt know you could go much further. Thanks.
@diegocrusius7 жыл бұрын
thank you for your kindess
@Brackeys7 жыл бұрын
NO! ... Okay yeah :)
@chickentim85056 жыл бұрын
xD
@Junglej0hn6 жыл бұрын
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.
@guillaumemaille75922 жыл бұрын
Thanks! This helped me!
@localSunMan7 жыл бұрын
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!
@samuelleigh227010 ай бұрын
Still using this 6 years later! Thanks!
@IdleGamer20810 ай бұрын
me too
@michaelanonymous31044 ай бұрын
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
@tonihenriksson23994 жыл бұрын
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
@rigzmoviediaries6545 жыл бұрын
Brackeys, without you I would be lost and stuck paying for a course. Thank you.
@fv4202x4 жыл бұрын
how are you now?
@rigzmoviediaries6544 жыл бұрын
@@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.
@artyWeeb4 жыл бұрын
@@rigzmoviediaries654 good luck
@cheesedabber3 жыл бұрын
@@rigzmoviediaries654 and how is that going for you now?
@marxiplier43224 жыл бұрын
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.
@Aessa76 жыл бұрын
Dude I love your direct style, you don't waste ANY time, and you trust the viewer to understand. Thank you so much.
@codersexpo15804 жыл бұрын
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!!
@codersexpo15804 жыл бұрын
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.
@ignatiusreilly82804 жыл бұрын
The visuals and lighting and smoke are awesome looking in that little game.
@nikitaprodanov52195 жыл бұрын
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.
@mohamedhousain56562 жыл бұрын
yea about that...
@gamerheroine3 жыл бұрын
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.
@diegocrusius7 жыл бұрын
if I could marry a youtube channel it would probably be this. One of the best Brackeys videos I saw so far.
@diegocrusius7 жыл бұрын
everything I needed about audio to my game is in this video.
@razcuks11294 жыл бұрын
@@GGOOSEO LMAO 69
@spaghetti_bro30934 жыл бұрын
A not an
@diegocrusius4 жыл бұрын
@@spaghetti_bro3093 thank you
@weluvsprxng4 жыл бұрын
@@diegocrusius wut
@hamez69702 жыл бұрын
i love the way these guys made sounds, with their mouth
@RealRushinRussian2 жыл бұрын
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.
@cjplanes2 жыл бұрын
Goddamn you are a genius
@tegxi2 жыл бұрын
I like your method, it seems far less janky. Though given that this tutorial is 5 years old your hostility seems excessive.
@Random_Coffee_Cup4 жыл бұрын
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
@shehzaanansari82047 жыл бұрын
Great video as always!
@neptunesnep94585 жыл бұрын
Overwatch lets go brother
@razorNeel4 жыл бұрын
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.
@razorNeel4 жыл бұрын
And now it has sound as well
@gulraiz192 жыл бұрын
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.
@shadbh22 жыл бұрын
genius
@umadkuzubad4 жыл бұрын
You are amazing! Years later and I'm still using your videos with great success. Thanks Brackeys.
@johncisors48327 жыл бұрын
Love your sound effects :D
@Brackeys7 жыл бұрын
Haha, thanks! :)
@dmitrij347 жыл бұрын
+Brackeys Why Array.Find? Why not a dictionary with try get value instead?
@sfaezamin5 жыл бұрын
Its just his voice
@place_holder21603 жыл бұрын
@@sfaezamin no shit sherlock
@tahahusain73284 жыл бұрын
Please Don't Stop Teaching Us Unity, We All Love You And Your Tutorial's. Thanks For Teaching Us Unity For Free
@lunarfoxgames3 жыл бұрын
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.
@Ajaxlancer3 жыл бұрын
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.
@pedrosalaspinero72204 жыл бұрын
YOU RESCUED ME FOR MY FIRST GAME JAM LOVE YOU FOREVER
@jasonallen26022 жыл бұрын
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 Жыл бұрын
Thank you...This was my exact issue
@user-account-not-found6 ай бұрын
This!☝
@SuperDutchrutter3 жыл бұрын
So useful. Going to miss the new uploads but hope your new adventures suit you well.
@shreddernation10965 жыл бұрын
My dude made a game about king Kai’s planet 😂😂 great vid man!
@GerGauss3 жыл бұрын
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
@BestJohnEver7 жыл бұрын
You rock man! Great programer, very organized and well explained! Thank you and never stop doing this videos!
@rastarish32017 жыл бұрын
Quite possibly, one of the most useful Unity tutorials I have ever come across! Thanks Brackeys!
@IronDizaster6 жыл бұрын
*you know, coding is easier than you think.*
@synthjc51055 жыл бұрын
You Know You ShOuLd TaKe ThIs OnlNe UniTy On UnEdEmy
@shk_5 жыл бұрын
@liberP lovPrimeNumbers YoU KnOw YoU dO
@Ab-gj1jw4 жыл бұрын
You know, coding is easier than you think when you just copy.
@apainush95404 жыл бұрын
change my mind
@TGR-ll8mc4 жыл бұрын
@@synthjc5105 fucking hate that ad
@stevanivanovic95792 жыл бұрын
Love the car voiceover work
@TigaLionessArt4 жыл бұрын
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?
@sulkingcrow74264 жыл бұрын
I'm not sure if this is still relevant but I had the same problem and had to set the pitch to 1
@TigaLionessArt4 жыл бұрын
@@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 ;)
@SillyCraftersOcCheng20004 жыл бұрын
@@TigaLionessArt Thank god i see the comments here so can finish my game devoloping project for uni
@jhgfghjfuzrtfchchghgf4 жыл бұрын
@@sulkingcrow7426 thanks for posting this! I was trying to get this to work for over an hour. this tutorial is broken :(
@sulkingcrow74264 жыл бұрын
@@jhgfghjfuzrtfchchghgf no problem! And it was a great tutorial, just a small (but important) part got looked over
@mohammedzaidkhan56873 жыл бұрын
The only tutorial I didn't understand by brackeys
@AboA7ma114 жыл бұрын
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; }
@AboA7ma114 жыл бұрын
@@flaymes make sure the other class name is "sounds"
@AboA7ma114 жыл бұрын
@@flaymes do adjustvolume("musicname", Slider.value);
@ptaroworm78873 жыл бұрын
Dude, you're a life saver. This is exactly what I was looking for. Thank you
@Somewhere_sometime_somehow2 жыл бұрын
@@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?
@AboA7ma112 жыл бұрын
@@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
@oxenfree61925 жыл бұрын
You're an amazing instructor. Please never stop. Your videos are so clean and direct, and you cover information so well.
@Soryn_Clark Жыл бұрын
That didn't age well lol
@turkym7md56 жыл бұрын
1:36 i could say that you stick your mouth on the microphone and say "phooooophooooooophoooooo" xD
@jroenning4 жыл бұрын
all your videos are just so easy to use and straight to the point thank you so much
@diablo4ever8683 жыл бұрын
does anyone have a link to the audio manager download? looks like the link in the video is broken
@DaMaLZ3 жыл бұрын
same
@afrorecording2 жыл бұрын
@@DaMaLZ actually it works hahah
@skyacaniadev22296 жыл бұрын
Those lovely mouth-crafted audio clips...
@nonnodacciaio7047 жыл бұрын
What if I want to stop the theme music, for example when Player dies?
@Yar39206 жыл бұрын
Nonno d' acciaio then destroy the audio manager
@JasonEkonomakos6 жыл бұрын
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
@dadmanful6 жыл бұрын
lol
@zoewalker20646 жыл бұрын
@@JasonEkonomakos how tho???
@JasonEkonomakos6 жыл бұрын
@@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
@DarthJeremy3643 жыл бұрын
i miss you brackeys
@taragitaratayo23046 жыл бұрын
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!
@Averysh5 жыл бұрын
Did anyone figure this out yet?
@kingdavegamess5 жыл бұрын
@@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 .
@serbaneduard50454 жыл бұрын
@@kingdavegamess thx. You help me a lot.
@kingdavegamess4 жыл бұрын
@@serbaneduard5045 no problem
@isaialusuardi4 жыл бұрын
@@kingdavegamess Thx it works!!!!
@Toopa884 жыл бұрын
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.
@ARTHUR145234 жыл бұрын
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?
@waterandtreefilms7 жыл бұрын
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
@SpeedySpee6 жыл бұрын
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-uf9og6 жыл бұрын
thank you so much
@vishnughosh28956 жыл бұрын
Thanks a lot
@trixygames7705 Жыл бұрын
legend
@sumitgohil26367 жыл бұрын
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.
@zacharyseebeck24097 жыл бұрын
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.
@ferguslees79947 жыл бұрын
Got the same issue here, appears in the audio manager but does not play...
@jeroeno_boy1496 жыл бұрын
same
@Shavinderyt6 жыл бұрын
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
@DarthZmex6 жыл бұрын
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_boy1496 жыл бұрын
try design your own, worked for me
@user-account-not-found6 ай бұрын
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.
@Dezmondo7777 жыл бұрын
The link to Audio Manager is not available anymore :((
ik, and it hurts cuz i need it to find my issues. I CANT FIND ANOTHER VIDEO THAT SHOWS MY FKN PROBLEM!@!!!@@!@@!@!@!!!!@@!
@pranavakp99604 жыл бұрын
You are the best teacher for coding games!!!
@maxageev3dart4 жыл бұрын
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 ?
@sean62693 жыл бұрын
Did you ever figure it out?
@maxageev3dart3 жыл бұрын
Sorry man. Don't remember. That's was almost a year ago.(( I already probably lost the project where was using this thing.
@sean62693 жыл бұрын
@@maxageev3dart I got it ;) he made another video on an options menu that was pretty similar to what I was trying to do
@ravestechworld64454 жыл бұрын
Thank you soooo much bracks you have no idea how many people have you helped!
@deaf_conformist4 жыл бұрын
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"
@wmka2 жыл бұрын
searched for " using audio unity " thank you and have a good one
@gdzantaf61445 жыл бұрын
is there a way to cancel sounds(like music) by having some kind of stop method?
@gdzantaf61445 жыл бұрын
@@kadir9629 Thx
@vrstepper12043 жыл бұрын
@@gdzantaf6144 StopMusic.cs(10,19): error CS0103: The name 'Array' does not exist in the current context.
@khnuxsora2 жыл бұрын
@@gdzantaf6144 can you tell me how you did it?
@dartutorials78594 жыл бұрын
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
@BlaZeLiink7 жыл бұрын
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.
@tudordumitrescu87077 жыл бұрын
DerLink he literally did a vid a week ago on this
@BlaZeLiink7 жыл бұрын
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...
@jrgen75276 жыл бұрын
I think maybe you should look into state machines @DerLink
@fateshow53034 жыл бұрын
This is the only video that I've found that has successfully worked for me. Thank you!
@Kaikaku7 жыл бұрын
Good timing, so far I have no audio in my program. This will now change :)
@KaiBeatbox08034 жыл бұрын
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.
@LRMTB4 жыл бұрын
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.
@shacharrodrigez75214 жыл бұрын
just make the music go again when the scene open
@LRMTB4 жыл бұрын
@@shacharrodrigez7521 yh the thing is i want it to continue from where it left off in the last scene
@cearaj4054 жыл бұрын
idk if you already found it out but just watch everything after 12:11
@LRMTB4 жыл бұрын
@@cearaj405 ah ok thanks lol
@micnasr Жыл бұрын
4 years later and I am still using the same Audio Manager that I used in 2019 lol
@Retr-eo5uz7 жыл бұрын
You're the best !
@peliculano6 жыл бұрын
Yes he is!
@ludicrouS_4064 жыл бұрын
Oh yeah, oh yeah!
@carlossierra19887 жыл бұрын
this new thumbnail style looks great
@animemotivasiofficial2 жыл бұрын
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
@mariothelongtongue46572 жыл бұрын
THANK YOU
@ThatAlx4 жыл бұрын
brackeys is the best coder ever keep it UP
@gaweringo7 жыл бұрын
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?
@SasukeUchiha7237 жыл бұрын
im having the same issue
@Axedogames7 жыл бұрын
Have you the volume option at maximum ? Is unity no muted in your Volume mixer ?
@Axedogames7 жыл бұрын
Is your AudioSource near an AudioListenner ?
@d1nkum3404 жыл бұрын
check the mute audio button isnt checked, its next to gizmos
@nextcent4 жыл бұрын
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.
@affe71306 жыл бұрын
How would I go about adding volume sliders to some of the sounds in my AudioManager?
@train_guy4 жыл бұрын
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
@brycebishop1866 жыл бұрын
You are the god of game development tutorials oh my damn
@Red_Dead_Chris6 жыл бұрын
The link for the download do not work anymore :(
@VirtualTurtleGames7 жыл бұрын
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
@CeretPenyok7 жыл бұрын
I can't hear the sounds when the object instantiated.
@benbuehler49725 жыл бұрын
pitch needs to be at least .1f for sound to be made.
@maiskorrel5 жыл бұрын
@@benbuehler4972 Thanks!
@TheNamelessTO4 жыл бұрын
@@benbuehler4972 Thank you!!
@cerisskies4 жыл бұрын
@@benbuehler4972 Life saver, I've been going mad here
@spacedog29803 жыл бұрын
@@benbuehler4972 thank you legend
@ioverexcitedninja4281 Жыл бұрын
Your tutorials are by far the best i could find out there 👍
@AlineoRykkeErrel6 жыл бұрын
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
@Viralfanatics3 жыл бұрын
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.
@AlineoRykkeErrel3 жыл бұрын
@@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
@Viralfanatics3 жыл бұрын
@@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?
@Viralfanatics3 жыл бұрын
Nevermind. I figured it out. Thanks a ton. Your comment helped a lot!!
@AlineoRykkeErrel3 жыл бұрын
@@Viralfanatics you're welcome haha, did you use DontDestroyOnLoad?
@ishaanchauhan31697 жыл бұрын
i love how you are going over each topic. thank u sm
@AlexVoxel7 жыл бұрын
Nice sound effects
@Vero2726-s8u2 жыл бұрын
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 !
@rickschroevers24975 жыл бұрын
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! 😄
@hajperdev4 жыл бұрын
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 (); }
@hajperdev4 жыл бұрын
Somebody posted it there, it's the same but you just stop instead of play
@vrstepper12043 жыл бұрын
@@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...
@hajperdev3 жыл бұрын
@@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
@vrstepper12043 жыл бұрын
@@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 :)
@developerssite99234 жыл бұрын
Brackeys is THE BESTTTTTTTTTTTTTTTTTTT!!!!!!!!!!!!!!!!!!!!! You had inspired me to make a game and now it will be available in sometime:)
@iZemash6 жыл бұрын
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-96 жыл бұрын
same
@ms-96 жыл бұрын
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 !
@taragitaratayo23046 жыл бұрын
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-96 жыл бұрын
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-96 жыл бұрын
Well knowing how the mixer works was not enough I had to do some c# research you'll find
@milomakesstuff20194 жыл бұрын
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-qn3py5 жыл бұрын
I can Play music but I can't stop it. How do i do that?
@GeorgeWulfers_884 жыл бұрын
You would need to call Stop() on the audio clip.
@vrstepper12043 жыл бұрын
@@GeorgeWulfers_88 how please? AudioManager.instance.Stop("MyMusic"); does not work.
@bruceb852 жыл бұрын
I feel like every high paying developer job expects a guy like brackeys that can actually code like this.
@omgtntlol5 жыл бұрын
0:37 for some reason I heard "Lets add some silence" XDXDXD
@marcuionut63193 жыл бұрын
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
@GoldenD604 жыл бұрын
TIMESTAMPS: Audio in Unity: 0026 Audio Manager: 04:01
@WhimsyCottage4 жыл бұрын
Did you get the script to work?
@ahmedsleem815 жыл бұрын
Thanks, but the link to Audio Manager is dead now
@fulgencejuniorlohore8543 жыл бұрын
You help me out buddy!!! Thanks for this tutorial! The Audio Manager is really useful!
@dcry10033 жыл бұрын
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
@fulgencejuniorlohore8543 жыл бұрын
@@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.
@dcry10033 жыл бұрын
@@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?