- Home /
How to control an AudioSource with an AudioClip?
Hi. I'm new to Unity and Game Development. I have a GameObject (named MusicManager) in my Scene, which has an AudioSource component on it. This has the AudioClip of the Background Music of my game. There's another GameObject (named SFXManager) having AudioSource. This plays the UI SOund or the SFX of the game. I didn't attach any AudioClip to the SFXManager. However, when the game starts the MusicManager starts to play the Background Music. And when the user clicks any UI Button in the game, the SFXManager plays the AudioClip. This AudioClip is played through a script with .PlayOneShot(). I want the MusicManager to lower its volume when SFXManager plays its Clip. And when the SFXManager ends its clip, the MusicManager brings its volume back to normal.
Answer by nabeelasad2007 · Feb 24 at 07:01 AM
Also, Unity has an official tutorial for this:-
https://www.youtube.com/watch?v=UJYN4_jUIQs&t=279s
Answer by VoidPhoenix96 · Feb 14 at 12:31 AM
Alright so just follow this tutorial: https://youtu.be/6OT43pvUyfY
Thank you for your reply. Realy appreciate Brackeys as well. But I didn't get my answer. However, I've recently found out about the Audio Mixer Duck Volume Effect. That worked for me.
Your answer
Follow this Question
Related Questions
Glitched Music 0 Answers
Delayed Button Sounds 0 Answers
Audio continuation through two scenes 3 Answers
How to play music/audio 2 Answers
UI Button Sounds Volume Increases when Mouse passes over 1 Answer