# FMOD hangs in unity periodically

**URL:** <https://qa.fmod.com/t/fmod-hangs-in-unity-periodically/17056>\
**Category:** FMOD Studio\
**Created:** [April 15, 2021, 1:20am UTC](https://qa.fmod.com/t/fmod-hangs-in-unity-periodically/17056 "2021-04-15T01:20:50Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![Andrew](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/andrew/32/261_2.png) [@Andrew](https://qa.fmod.com/u/Andrew)\
**Post date:** [June 17, 2021, 10:47pm UTC](https://qa.fmod.com/t/fmod-hangs-in-unity-periodically/17056/21 "2021-06-17T22:47:05Z")

</div>

[fmod.com](http://fmod.com) uploads are fixed, thanks for bringing that to our attention. We have your repro and will get back to you shortly.

---

<div class="post-metadata">

**Author:** ![sel\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/sel_fmod/32/1766_2.png) [@sel\_fmod](https://qa.fmod.com/u/sel_fmod)\
**Post date:** [June 22, 2021, 5:12am UTC](https://qa.fmod.com/t/fmod-hangs-in-unity-periodically/17056/22 "2021-06-22T05:12:22Z")

</div>

I’ve successfully reproduced the issue in both your reproduction project and a blank project. This issue appears to be a bug in the Unity Editor specific to macOS machines:

When the Unity Editor loses and regains focus while play mode is paused, `OnApplicationPause` is called with a value of true for the `pauseStatus` parameter. Future calls to `OnApplicationPause` will maintain this true value for `pauseStatus`, persisting across exiting and re-entering play mode (and including the call made to `OnApplicationPause` when a GameObject is created). When the Unity Editor next loses focus, `OnApplicationPause` is called with a false value, and returns to normal behaviour until the above is repeated.

The FMOD RuntimeManager instance pauses all events when it receives `OnApplicationPause(true)`, and resumes event playback when it receives `OnApplicationPause(false)`. In combination with the issue above, this means that the Editor losing and regaining focus while play mode is paused stops all audio playback until focus is lost again.

I’ve submitted a bug report to Unity regarding this issue. In the meantime, a potential workaround is to wrap `RuntimeManager.OnApplicationPause` in an `#if !UNITY_EDITOR_OSX` directive. Note that if you have “Run In Background” disabled in your project settings, doing this will cause the audio to continue playing when the Editor loses focus (while the game scene is otherwise paused).

---

<div class="post-metadata">

**Author:** ![VoodooDetective](https://avatars.discourse-cdn.com/v4/letter/v/ecc23a/32.png) [@VoodooDetective](https://qa.fmod.com/u/VoodooDetective)\
**Post date:** [June 22, 2021, 5:43pm UTC](https://qa.fmod.com/t/fmod-hangs-in-unity-periodically/17056/23 "2021-06-22T17:43:07Z")

</div>

Thanks for digging into this. My biggest fear was that this is something that could appear in the real builds of the game, but it doesn’t sound like that’s the case so I’m 100% satisfied. Thanks so much for making sure it wasn’t something less innocuous!

---

<div class="post-metadata">

**Author:** ![sel\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/sel_fmod/32/1766_2.png) [@sel\_fmod](https://qa.fmod.com/u/sel_fmod)\
**Post date:** [June 23, 2021, 2:07am UTC](https://qa.fmod.com/t/fmod-hangs-in-unity-periodically/17056/24 "2021-06-23T02:07:51Z")

</div>

Just following up, Unity has added this bug to their issue tracker, so you’ll be able to monitor the progress of it there.

> **[Unity IssueTracker - OnApplicationPause pauseStatus is incorrect after losing...](https://issuetracker.unity3d.com/issues/onapplicationpause-pausestatus-is-incorrect-after-losing-focus-on-macos)**
>
> Reproduction steps: 1. Open the attached project 2. Open SampleScene 3. Enter play mode. Note that "OnApplicationPause(false)" is lo...

---

<div class="post-metadata">

**Author:** ![VoodooDetective](https://avatars.discourse-cdn.com/v4/letter/v/ecc23a/32.png) [@VoodooDetective](https://qa.fmod.com/u/VoodooDetective)\
**Post date:** [June 24, 2021, 1:39am UTC](https://qa.fmod.com/t/fmod-hangs-in-unity-periodically/17056/25 "2021-06-24T01:39:17Z")

</div>

Thanks much!

[Previous page](https://qa.fmod.com/t/fmod-hangs-in-unity-periodically/17056.md?page=1)
