Introduction to AUDIO in Unity

37
8



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/

37 COMMENTS

  1. 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

  2. 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!

  3. 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?

  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 😀

  5. help. does that not mean the sounds all come from the audio manager instead of the game object? can anyone tell me 🙂

  6. 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?

  7. 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?

  8. 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?

  9. 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.

  10. 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!!

  11. 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

  12. 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.

  13. 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?

  14. 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.

  15. 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;

    }

  16. if you get the following error:
    ''Invalid token 'void' in class, struct, or interface member declaration ''
    write public (lowercase) instead of Public.

  17. 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?

LEAVE A REPLY

Please enter your comment!
Please enter your name here