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.
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
23.08.2024
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.
ı have discovered this channel recently,it's so useful thanks;
Great to find your chanel👍🏻
What if the audiomanager has different scenes?
THANK YOU SO MUCH!!!!
"Sicript" lmao brooo… but dont worry the tutorial is cool, thanks!
how to add more than one musicsource?
kiss me
This was so clear and helpful, thank you <3
Great tutorial appreciated!
Hocam yaptığınız oyun gerçekten çok güzel görünüyor ellerinize sağlık 🙂
thanks i'm starting to make my own 2d game
keep it up
Hello. What is the format of the music file you used?
Dostum ellerine sağlık çok yardımcı oldun çok teşekkür ederim 💙
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)
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!
comawn what are you doing in the particle controller?
get out of there 😭
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?
How can I continue playing my music in other scene?
Si cript
why mine sounds doesnt play, i try to call it in other scripts but nothing happened, i already add audio listener in main camera
Amazing tips!
Love your C-Krypt tutorial bro 😂😂
This is the only tutorial where I smile and learn at the same time, looking more from you! 💯
5:14 Well played Sir… and thank you for the video <3
Code source unity de game please
thank you very much. you made my day so much better
How did you declare it as AudioManager audioManager? Mine doesn't recognize the namespace AudioManager? How can I fix this?
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 🙂
Got a new subscriber.
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? …
i cant drag and drop the SFX Source in the missing audio source pls help
lütfen kodlarıda ekle
Nice. Also randomize the pitch of the sound fx. So it can sound slightly different each time.
Thank You !!!!!! for this tutorial.
Hey, how do you make it so the background music loops when done?
casual game sound arent these gorilla tag sounds
why on my visual script kinda different about this 3:32, am i get something wrong?
adamsın kanka
very nice! Thank you !
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?
1:18 Gorilla tag SFX
nice tut bro
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.
this is so helpfull , Thankyou very much
Thanks, this is a short and simple tutorial that doesn't overcomplicate things. Those are hard to find these days.
Thanks so much ! Nice video Sir !!
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 😉
Script❌Siciript✅
Really thank you.