How to Add MUSIC and SOUND EFFECTS to a Game in Unity | Unity 2D Platformer Tutorial #16 - accordion-games.com

How to Add MUSIC and SOUND EFFECTS to a Game in Unity | Unity 2D Platformer Tutorial #16

Rehope Games
Views: 63627
Like: 1283
In this Unity 2D Tutorial we’ll learn How to add MUSIC and SOUND EFFECTS to a Game.
In this Audio Manager Tutorial we’ll add background music and various sound effects to our 2D Platformer game. We’ll Create very simple Audio Manager C# Script to control music and SFX.

Enjoy the video ☕

————————————————————————————
🖐 Hi Game developer
Welcome to Rehope Games I’m Murat

I share unity tutorial videos on my channel. if you want to make a game with unity (especially 2d platformer game), the videos here will definitely interest you.

————————————————————————————

#unitytutorials, #unity2d, #unity2dplatformer

48 Comments

  1. Tomorrow I sit down to my platformer and add stuff from this series. Seriously, I discovered this channel today, and it's perfect when it came to us making a platformer. Could you make a tutorial for levels like in Dadish? It means that we can choose a level in the menu and when we beat one level we go to another. That would be really useful. Also, if you did a video like this, could you explain how I can add something to it before going to the next level?
    I know I'm asking for too much (lol) but I am currently learning to program and it would be very useful to me, because I know Unity, but only the basics of C# and i cant create good scripts, only veerry basic. Sorry for the long comment and requests. If ever my platformer succeeds and be very big game, it's your fault too. And other YouTubers.

  2. ı have discovered this channel recently,it's so useful thanks;

  3. Great to find your chanel👍🏻

  4. What if the audiomanager has different scenes?

  5. THANK YOU SO MUCH!!!!

  6. "Sicript" lmao brooo… but dont worry the tutorial is cool, thanks!

  7. how to add more than one musicsource?

  8. This was so clear and helpful, thank you <3

  9. Great tutorial appreciated!

  10. Hocam yaptığınız oyun gerçekten çok güzel görünüyor ellerinize sağlık 🙂

  11. thanks i'm starting to make my own 2d game

  12. Hello. What is the format of the music file you used?

  13. Dostum ellerine sağlık çok yardımcı oldun çok teşekkür ederim 💙

  14. Hey Rehope, my code is giving me a error when I use the GetComponent<AudioManager>

    Its saying that 'GameObject[]' does not contain a definition for 'GetComponent' and no accesibl extension method 'GeComponent' accepting a first argument of type 'GameObject[] ' could be found

    How can I fix this ? – I'm using Unity 2020.3.30f1 (btw)

  15. I swear the tutorials that are the most helpful are so underrated and low views, you have no idea how much this helped me. THANK YOU!

  16. comawn what are you doing in the particle controller?
    get out of there 😭

  17. Hello why wont the audio play on my game?
    Why does it work only when i put my audio inside the "Audio Source" Component, unlike yours?

  18. How can I continue playing my music in other scene?

  19. why mine sounds doesnt play, i try to call it in other scripts but nothing happened, i already add audio listener in main camera

  20. Love your C-Krypt tutorial bro 😂😂
    This is the only tutorial where I smile and learn at the same time, looking more from you! 💯

  21. 5:14 Well played Sir… and thank you for the video <3

  22. Code source unity de game please

  23. thank you very much. you made my day so much better

  24. How did you declare it as AudioManager audioManager? Mine doesn't recognize the namespace AudioManager? How can I fix this?

  25. Hello, I have tried your tutorial, but I encounter a problem, I have changed the script to make it destroy the audio manager in scene 2, so there's duplicated audio manager, only the one from scene 1 will be active.
    the song is keep playing continuously , but the the sfx I assigned to my buttons in scene 2 don't work, it show missing (object), even tho there audio manager (from scene 1).
    it will be really appreciated if you help me to solve this 🙂

  26. Hi Rehope! Awesome tutorial, thank you <3
    I however stumbled across a problem.

    This morning I was testing my game and the sound for my movement was absolutely fine and worked as expected, now since a few hours however (after editing some other things that had nothing do to with audio, only with text appearing and dissapearing after a button press), whenever I move my player the SFX for moving suddenly is VERY distorted. Like a lot. It also makes the background music stop and it will only resume again if I let go of my move buttons.

    I already checked the file itself and it is fine, and the rest of the audio works fine as well.

    Would you have any idea what the problem might be? …

  27. i cant drag and drop the SFX Source in the missing audio source pls help

  28. lütfen kodlarıda ekle

  29. Nice. Also randomize the pitch of the sound fx. So it can sound slightly different each time.

  30. Thank You !!!!!! for this tutorial.

  31. Hey, how do you make it so the background music loops when done?

  32. casual game sound arent these gorilla tag sounds

  33. why on my visual script kinda different about this 3:32, am i get something wrong?

  34. very nice! Thank you !

  35. it didn't work for me, i got this error AssetsParticleController.cs(56,29): error CS0246: The type or namespace name 'Particles' could not be found (are you missing a using directive or an assembly reference?) and I typed everything you typed but it didn't work.
    and here is my script:

    using System.Collections;

    using System.Collections.Generic;

    using UnityEngine;

    public class ParticleController : MonoBehaviour

    {

    [Header("Movement Particle")]

    [SerializeField] ParticleSystem movementParticle;

    [Range(0,10)]

    [SerializeField] int occurAfterVelocity;

    [Range(0,0.2f)]

    [SerializeField] float dustFormationPeriod;

    [SerializeField] Rigidbody2D playerRb;

    float counter;

    bool isOnGround;

    [Header("")]

    [SerializeField] ParticleSystem fallParticle;

    [SerializeField] ParticleSystem touchParticle;

    [SerializeField] ParticleSystem dieParticle;

    AudioManager audioManager;

    private void Awake()

    {

    audioManager = GameObject.FindGameObjectWithTag("Audio").GetComponent<AudioManager>();

    }

    private void Start()

    {

    touchParticle.transform.parent = null;

    dieParticle.transform.parent = null;

    }

    private void Update()

    {

    counter += Time.deltaTime;

    if (isOnGround && Mathf.Abs(playerRb.velocity.x) > occurAfterVelocity)

    {

    if (counter > dustFormationPeriod)

    {

    movementParticle.Play();

    counter = 0;

    }

    }

    }

    public void PlayParticle(Particles particle, Vector2 pos = default(Vector2))

    {

    switch (particle)

    {

    case Particles.touch:

    audioManager.PlaySFX(audioManager.wallTouch);

    touchParticle.transform.position = pos;

    touchParticle.Play();

    break;

    case Particles.fall:

    audioManager.PlaySFX(audioManager.wallTouch);

    fallParticle.Play();

    break;

    case Particles.die:

    audioManager.PlaySFX(audioManager.death);

    dieParticle.transform.position = pos;

    dieParticle.Play();

    isOnGround = false;

    break;

    default:

    break;

    }

    }

    }

    what could I have done wrong?

  36. when adding SFX sounds.
    And trying to write code GetComponet.
    I kept getting a error and was not able to add SFX this way.
    Had to use a SRC Component which let me add SRC Sounds to my script and then use them in code.

    If anyone know why I was getting that error on FindGameObjectWithTag line.
    Was getting error on GetComponent audioManager.

  37. this is so helpfull , Thankyou very much

  38. Thanks, this is a short and simple tutorial that doesn't overcomplicate things. Those are hard to find these days.

  39. Thanks so much ! Nice video Sir !!

  40. This is an awesome tutorial, I am only running into one issue. I am making a game with zombies, and i have an audio clip play when a zombie sees me. The problem is that when multiple of the same audio play, it gets super loud and distorted for some reason. I am unsure as to why. I hope you can help me 😉

  41. Script❌Siciript✅

Comments are closed.