# If I put all my SFX in one mixer channel how can I control the channel with a slider in unity?

**URL:** <https://qa.fmod.com/t/if-i-put-all-my-sfx-in-one-mixer-channel-how-can-i-control-the-channel-with-a-slider-in-unity/13219>\
**Category:** Unity\
**Created:** [June 6, 2017, 9:06am UTC](https://qa.fmod.com/t/if-i-put-all-my-sfx-in-one-mixer-channel-how-can-i-control-the-channel-with-a-slider-in-unity/13219 "2017-06-06T09:06:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jackquinton](https://avatars.discourse-cdn.com/v4/letter/j/91b2a8/32.png) [@Jackquinton](https://qa.fmod.com/u/Jackquinton)\
**Post date:** [June 6, 2017, 9:06am UTC](https://qa.fmod.com/t/if-i-put-all-my-sfx-in-one-mixer-channel-how-can-i-control-the-channel-with-a-slider-in-unity/13219/1 "2017-06-06T09:06:23Z")

</div>

In my game I have a menu an audio section and inside of that is a button to toggle audio on and off and a slider to adjust the level of the sound effects. Ideally I would like 100% on the slider to be at 0dB but I can’t wrap my head around how to script it. Any help please?

Edit: I’ve created a snapshot called SFXvol and a corresponding event to house it. Inside the snapshot it says I can automate the volume fader on the sfx channel but where do I go form here? I know how to connect the parameter to the slider in unity.

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [June 7, 2017, 6:03am UTC](https://qa.fmod.com/t/if-i-put-all-my-sfx-in-one-mixer-channel-how-can-i-control-the-channel-with-a-slider-in-unity/13219/2 "2017-06-07T06:03:37Z")

</div>

You could use a snapshot but adjusting the volume of the corresponding buses would be easier, especially when using the Unity GUI Sliders.  
`
FMOD.Studio.Bus sfxBus;
Slider sfxSlider;`

sfxBus = FMODUnity.RuntimeManager.GetBus(busName);  
sfxBus.getFaderLevel/getVolume(out volume); // Depending on the version of FMOD  
sxfSlider.value = volume;  
  
Then you can setup functions for when the slider value changes.  
`
void OnSFXValueChange()
{
volume = sfxSlider.value;
sfxBus.setFaderLever/setVolume(volume); // Depending on the version of FMOD
}
`

---

<div class="post-metadata">

**Author:** ![Jackquinton](https://avatars.discourse-cdn.com/v4/letter/j/91b2a8/32.png) [@Jackquinton](https://qa.fmod.com/u/Jackquinton)\
**Post date:** [June 7, 2017, 8:16pm UTC](https://qa.fmod.com/t/if-i-put-all-my-sfx-in-one-mixer-channel-how-can-i-control-the-channel-with-a-slider-in-unity/13219/3 "2017-06-07T20:16:59Z")

</div>

> [@](#):
>
> You could use a snapshot but adjusting the volume of the corresponding buses would be easier, especially when using the Unity GUI Sliders.  
> `
> FMOD.Studio.Bus sfxBus;
> Slider sfxSlider;`
> 
> `
> `
> 
> `sfxBus = FMODUnity.RuntimeManager.GetBus(busName);
> sfxBus.getFaderLevel/getVolume(out volume); // Depending on the version of FMOD
> sxfSlider.value = volume;
> `  
> Then you can setup functions for when the slider value changes.  
> `
> void OnSFXValueChange()
> {
> volume = sfxSlider.value;
> sfxBus.setFaderLever/setVolume(volume); // Depending on the version of FMOD
> }
> `

Thanks for the help.  
This is probably one of those things that will seem super easy to me in the near future but i’m struggling a little to understand at the moment.

first off,  
sfxBus = FMODUnity.RuntimeManager.GetBus(busName);

I’m guessing this section all goes inside the awake/start function and where it says ‘(busname)’ I’m not sure what to put. Is it literally like calling a parameter in fmod and writing what I’ve called my bus in single quote marks?

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [June 7, 2017, 10:16pm UTC](https://qa.fmod.com/t/if-i-put-all-my-sfx-in-one-mixer-channel-how-can-i-control-the-channel-with-a-slider-in-unity/13219/4 "2017-06-07T22:16:33Z")

</div>

Yep that’s exactly how you could do it.

The bus naming convention is similar to events and banks as well. (eg. “bus:/” is the master bus)

---

<div class="post-metadata">

**Author:** ![Jackquinton](https://avatars.discourse-cdn.com/v4/letter/j/91b2a8/32.png) [@Jackquinton](https://qa.fmod.com/u/Jackquinton)\
**Post date:** [June 12, 2017, 7:29pm UTC](https://qa.fmod.com/t/if-i-put-all-my-sfx-in-one-mixer-channel-how-can-i-control-the-channel-with-a-slider-in-unity/13219/5 "2017-06-12T19:29:22Z")

</div>

I’ve tried some different versions of what you have said and can’t figure it out. I’m getting these as errors, any ideas?

[[Album] Imgur ![](https://i.imgur.com/YdVfhbm.jpg?fb "Imgur") ](https://imgur.com/a/hq1Bd)

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [June 12, 2017, 10:25pm UTC](https://qa.fmod.com/t/if-i-put-all-my-sfx-in-one-mixer-channel-how-can-i-control-the-channel-with-a-slider-in-unity/13219/6 "2017-06-12T22:25:04Z")

</div>

GetBus() is expecting a string.  
You will either need to use a string variable or use “bus:/SFX” (with quotation marks).

---

<div class="post-metadata">

**Author:** ![Jackquinton](https://avatars.discourse-cdn.com/v4/letter/j/91b2a8/32.png) [@Jackquinton](https://qa.fmod.com/u/Jackquinton)\
**Post date:** [June 13, 2017, 11:23am UTC](https://qa.fmod.com/t/if-i-put-all-my-sfx-in-one-mixer-channel-how-can-i-control-the-channel-with-a-slider-in-unity/13219/7 "2017-06-13T11:23:53Z")

</div>

I’m still getting these errors, any ideas?  
[http://imgur.com/a/ptbhQ](http://imgur.com/a/ptbhQ)
