Learn how to add sound to your game!
● Download Audio Manager:
● Audio Import Settings:
♥ Support my videos on Patreon:
····················································································
♥ Donate:
♥ Subscribe:
● Website:
● Facebook:
● Twitter:
····················································································
Edited by the lovely Sofibab.
····················································································
► All content by Brackeys is 100% free. I believe that education should be available for everyone. Any support is truly appreciated so I can keep on making the content free of charge.
····················································································
♪ Music (Too Cool) by: David Cutter Music –
♪ Baby Plays Electro Games
Nguồn: https://trulyluminary.com/
Xem thêm bài viết khác: https://trulyluminary.com/game/
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
The speed of this almost gave me a mini panic attack. Great stuff though.
Great tutorial, your Audio Manager will be a default now on my architectures!
Question: why can't I pass AudioManager.Play() a String Variable? If I use Play("Chomp") as an argument, works great and plays the sound. If I use Play(ChomprString) with value "Chomp", throws me an error.
NullReferenceException: Object reference not set to an instance of an object
AudioManager.Play (System.String name) (at Assets/AudioManager.cs:24)
Food.OnCollisionEnter2D (UnityEngine.Collision2D collision) (at Assets/Food.cs:43)
thanks a lot!
error CS0103: The name 's' does not exist in the current context
help?
how can import an audio game over when the player is dead
Thanks Brackeys! Any idea on how to make the sounds 3D. I am thinking cloning sound game objects and moving them to a source and then destroying them. Do you have a better way? Anyone?
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 😀
Why it says that "The name 'Array' does not exist in the current context"
help. does that not mean the sounds all come from the audio manager instead of the game object? can anyone tell me 🙂
These tutorials are awesome! Thank you!
Quick question though. The theme keeps playing in the editor when switching between scenes, however when i build the game it stops playing on transition. How do i fix this?
And dont stop:)
Your Audio is like Mr.Beast 😀
The console shows me an error saying that "the namespace '<global namespace> ' already contains a definition for 'Sound' ". It's referring to the public class in the Sounds script. Can somebody help me please?
Im actually working on a game called "Slice". If you want to learn more about it, please awser me.
am i the only one who is having the problem where the sound is being played in every scenario except for when i want it to?. For example, i have a sound for walking but when i walk the sound doesn't play, but it does play when i sprint, crouch, stand and so forth. Does anyone know whats going on?
im curious if i should use the internal keyword if i dont want it to show up in inspector.. or when should i ever use internal.
umm its just u going woooooooooooo.. right??
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!!
Yur goood
Love Your Videos keep up the good work brackeys (i sorry i could find your real name)
You are the best teacher for coding games!!!
i need to use audiosource.isPlaying how do i do that now ?
Man i swear ur a legend thx bro 🤙🏻
Whoever disliked this, get out. This is some of the best content ever.
everything is working fine except my background music 🙁 did everything exactly as you did
my jump sound works my death sound works and even my coin collecting works
wish if code was like writing English
thank you 😀
why this audio file is not downloading it keeps saying error
I'm having a problem with looping. When looping audio there is a 0.5sec pause when it loops. I've been doing research
and everyone's saying it's only with mp3 files, but, all my audio files are wav. and it happening and there is no blank audio when i play it looping on any other sound editor. PLZZZZZZZZ HEEELLLLLLLLLLPPPPPPPP.
Thanks a lot Sir 🤗
Awesome stuff! Keep it up! 🙂
The best lecture about unity audio manager. Thanks a lot. [SUBSCRIBED] 🙂
Great Video! I have a question. Generally, finding via strings is a slow process, so my question is, would it be quicker if I were to assign an ID via animator.stringtohash() for each sound, then adding a line in the play(string) command to convert the string into ID then just find the sound using that?
Very nice video, I learned a lot.
However, is it not somehow messy to have all the sounds and music in the audio manager? If you have like 50+ different sounds it can be quite hard to keep it organized. I had thought storing sounds of folders regarding the game objects: The sounds of the player in the player folder, sounds of enemies in the enemy's folder, etc.
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;
}
if you get the following error:
''Invalid token 'void' in class, struct, or interface member declaration ''
write public (lowercase) instead of Public.
Hey, I have an issue where my audio buzzes. It is a wall slide sound fx, and I know the problem. I am playing the audio when I can wall slide but every time I can do this, i play the audio. If I am wall sliding then this is true many times, and so I get a buzzing sound. Does anybody know how to fix it using this system?