# UNITY - SetVolume(0) not muting the volume of Event

**URL:** <https://qa.fmod.com/t/unity-setvolume-0-not-muting-the-volume-of-event/13876>\
**Category:** FMOD Studio\
**Created:** [May 15, 2018, 2:24am UTC](https://qa.fmod.com/t/unity-setvolume-0-not-muting-the-volume-of-event/13876 "2018-05-15T02:24:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![facaelectrica](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/facaelectrica/32/105_2.png) [@facaelectrica](https://qa.fmod.com/u/facaelectrica)\
**Post date:** [May 15, 2018, 2:24am UTC](https://qa.fmod.com/t/unity-setvolume-0-not-muting-the-volume-of-event/13876/1 "2018-05-15T02:24:43Z")

</div>

Using Fmod Studio with Unity and trying to mute an Event but not working.  
I’m using setVolume(0) to mute it and debugging with getVolume()

No matter what I set under setVolume, the getVolume() ‘finalVolume’ doesn’t change.  
I’m sure I’m doing something wrong, but not what.

This is how I initialize the event in Unity:

//Create event  
audioProperties.musicInstance = FMODUnity.RuntimeManager.CreateInstance(eventRef);  
FMODUnity.RuntimeManager.AttachInstanceToGameObject(newAudioInstance, parentSource.GetComponent(), parentSource.GetComponent());  
audioProperties.musicInstance.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(parentSource.transform));

//Start event and mute it  
audioProperties.musicInstance.start();  
audioProperties.musicInstance.setVolume(0);

Any help greatly appreciated!

---

<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:** [May 18, 2018, 6:20am UTC](https://qa.fmod.com/t/unity-setvolume-0-not-muting-the-volume-of-event/13876/2 "2018-05-18T06:20:51Z")

</div>

I’m not aware of any reason why that would not work.  
Most FMOD functions will return a FMOD.RESULT, which if it fails will give you an indication as to why.

You could also check the fmod log (found in the menu FMOD/Log Viewer).

---

<div class="post-metadata">

**Author:** ![facaelectrica](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/facaelectrica/32/105_2.png) [@facaelectrica](https://qa.fmod.com/u/facaelectrica)\
**Post date:** [May 18, 2018, 6:23am UTC](https://qa.fmod.com/t/unity-setvolume-0-not-muting-the-volume-of-event/13876/3 "2018-05-18T06:23:15Z")

</div>

> [@](#):
>
> I’m not aware of any reason why that would not work.  
> Most FMOD functions will return a FMOD.RESULT, which if it fails will give you an indication as to why.
> 
> You could also check the fmod log (found in the menu FMOD/Log Viewer).

Thanks for the help. I’ve figured it out. I had another function on update doing a setVolume(1) to all audio sources every frame, so it just kept reverting…my bad!

---

<div class="post-metadata">

**Author:** ![slitherpunk](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@slitherpunk](https://qa.fmod.com/u/slitherpunk)\
**Post date:** [July 28, 2021, 2:26am UTC](https://qa.fmod.com/t/unity-setvolume-0-not-muting-the-volume-of-event/13876/4 "2021-07-28T02:26:27Z")

</div>

I’m having a very similar issue. Except I don’t have any other setVolumes happening, and when I check the volume afterward via getVolume, it did save the setting, except it’s still playing at full volume.

code looks like this

{

```
FMOD.Studio.Bus bus;

private float busVolume;

private float currentVolume;

void Start()
{
  bus = FMODUnity.RuntimeManager.GetBus("bus:/In Game");
  UpdateVolume();
}

void OnEnable(){
  SettingsMenu.SoundUpdate += UpdateVolume;
}

void OnDisable(){
  SettingsMenu.SoundUpdate -= UpdateVolume;
}

void Update()
{

}

void UpdateVolume(){
  busVolume = PlayerPrefs.GetFloat("BGMVol", 0.5f);
  bus.setVolume(busVolume);
  bus.getVolume(out currentVolume);
  Debug.Log(currentVolume);
}

```

}

---

<div class="post-metadata">

**Author:** ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)\
**Post date:** [July 29, 2021, 1:28am UTC](https://qa.fmod.com/t/unity-setvolume-0-not-muting-the-volume-of-event/13876/5 "2021-07-29T01:28:33Z")

</div>

What is the value range you are passing into setVolume? Have you tried checking the results to see if the getVolume and setVolume calls are passing? i.e

```auto
void UpdateVolume()
{
    busVolume = PlayerPrefs.GetFloat("BGMVol", 0.5f);
    FMOD.RESULT result = bus.setVolume(busVolume);
    if (result != FMOD.RESULT.OK) Debug.Log("Failed to set volume!");

    result = bus.getVolume(out currentVolume);
    if (result != FMOD.RESULT.OK) Debug.Log("Failed to set volume!");

    Debug.Log(busVolume);
    Debug.Log(currentVolume);
}

```
