- Home /
How to mute specific audio sources?
How do I access the audio source of a specific object?
For example if I have a Bob object that wants to mute the audio source of a Steve object while continuing to play Bob objects audio source.
Answer by robertbu · Jul 16, 2014 at 12:39 AM
If your 'Steve' object has a unique name or a unique tag, you can do the following:
GameObject.Find("Steve").audio.mute = true;
Or with a unique tag:
GameObject.FindWithTag("Steve").audio.mute = true;
GameObject.audio has been deprecated. here is a solution that works now: http://stackoverflow.com/questions/24770249/how-can-i-mute-specific-audio-sources-in-unity3d
Answer by rutter · Jul 16, 2014 at 12:41 AM
Given an AudioSource, you can stop it, pause it, or mute it.
To do that, you need to know which AudioSource you're targeting. The simplest thing is usually to show a variable in the inspector, so that you can set it by hand.
You can also use GameObject.Find or FindWithTag and GetComponent to find the AudioSource.
This is a lot of reading, but understanding how to find other objects in the scene is crucial to developing games in Unity.
Answer by IsaiahKelly · May 07, 2016 at 08:56 PM
The most flexible and powerful way to do this would be with an audio mixer.
Create an audio mixer asset in your project.
Add two groups to the audio mixer named "Bob" and "Steve".
Assign audio mixer group "bob" to the output field of the audio source for Bob.
Assign audio mixer group "Steve" to the output field of the audio source for Steve.
Now you can do all sorts of really advanced things through the audio mixer. Like decreasing the audio level of everything except Bob. This is a technique known as "audio ducking" and sounds exactly like what you want. Check out the official Audio Mixer and Audio Mixer Groups Tutorial to learn more.
Your answer
![](https://koobas.hobune.stream/wayback/20220613154204im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Problems with Audio Sources 1 Answer
Distribute terrain in zones 3 Answers
How to destory gameObject without destroying the audio source attached to it? 2 Answers