# \[setVolume does not work\] OnApplicationFocus , Unity, Android platform

**URL:** <https://qa.fmod.com/t/setvolume-does-not-work-onapplicationfocus-unity-android-platform/17198>\
**Category:** Unity\
**Tags:** unity\
**Created:** [May 14, 2021, 6:48am UTC](https://qa.fmod.com/t/setvolume-does-not-work-onapplicationfocus-unity-android-platform/17198 "2021-05-14T06:48:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![paipaixiong116](https://avatars.discourse-cdn.com/v4/letter/p/c5a1d2/32.png) [@paipaixiong116](https://qa.fmod.com/u/paipaixiong116)\
**Post date:** [May 14, 2021, 6:48am UTC](https://qa.fmod.com/t/setvolume-does-not-work-onapplicationfocus-unity-android-platform/17198/1 "2021-05-14T06:48:24Z")

</div>

hello , help ~

fmod version is 2.00.10 , unity version is 2018.4.34f1, platform is Android .

when my apk change to run in background , my script function “OnApplicationFocus” effect , in this function, my background music EventInstance , setVolume(0) , but it’s not work .

I sure the same script and logic is work with fmod version 1.10.13 .

a problem in new version or there is a new rule to process this demand ？

---

<div class="post-metadata">

**Author:** ![joseph](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/joseph/32/264_2.png) [@joseph](https://qa.fmod.com/u/joseph)\
**Post date:** [May 17, 2021, 1:16am UTC](https://qa.fmod.com/t/setvolume-does-not-work-onapplicationfocus-unity-android-platform/17198/2 "2021-05-17T01:16:13Z")

</div>

What exactly happens when you attempt to use your script function, and how does it differ from what you intend to happen?

---

<div class="post-metadata">

**Author:** ![paipaixiong116](https://avatars.discourse-cdn.com/v4/letter/p/c5a1d2/32.png) [@paipaixiong116](https://qa.fmod.com/u/paipaixiong116)\
**Post date:** [May 17, 2021, 2:16am UTC](https://qa.fmod.com/t/setvolume-does-not-work-onapplicationfocus-unity-android-platform/17198/3 "2021-05-17T02:16:43Z")

</div>

1. my script function will set all event volume to zero (“OnApplicationFocuss(false)”) when my game change to run in background . Resume their volume (“OnApplicationFocuss(true)”) when my game cut back from background to foreground.  

2. I don’t want to pause all events when the game change to run in background , so I delete this function “OnApplicationPause” in Script “RuntimeManager” . if I don’t delete this function , when I Cast a skill that lasts 5 seconds and change game to the background in 2 seconds , after 10 seconds , I cut back from background to foreground , I can still hear this skill sound (“OnApplicationPause” in RuntimeManager will resume paused events) , it’s not a good process .  

3. I don’t know why my logic in IOS platform is right and effect , but it’s does not work in Android platform .

4. current fmod version is 2.00.10 , has problem in Android platform, but IOS is ok.  
old fmod version is 1.10.13, Android and IOS are all right .

---

<div class="post-metadata">

**Author:** ![joseph](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/joseph/32/264_2.png) [@joseph](https://qa.fmod.com/u/joseph)\
**Post date:** [May 27, 2021, 2:03am UTC](https://qa.fmod.com/t/setvolume-does-not-work-onapplicationfocus-unity-android-platform/17198/4 "2021-05-27T02:03:47Z")

</div>

Thanks for clarification, but I’m afraid I still don’t understand: What exactly happens when you attempt to use your script function?
