Answered
0
0

This is the code in Unity, but it can’t be called when alarm clock actived and unactived.
When alarm clock is active, the game goes silent.
When alarm clock is closed with the game is not in background, the game keep silent.
I’m looking for any API can be called in Unity when alarm clock actived or unactived, and the result is OnApplicationPause and OnApplicationFocus have some relation with the problem, but there can’t be called when alarm clock actived or unactived.
I hava seen the suggestions in https://www.fmod.com/resources/documentation-api?page=content/generated/platform_ios/basics.html#/, but it is the suggesstions for ios develop, not for unity.

This is the Code in Unity!!!

RuntimeManager.cs

void OnApplicationPause(bool pauseStatus)
{
if (studioSystem.isValid())
{
// Strings bank is always loaded
if (loadedBanks.Count > 1)
PauseAllEvents(pauseStatus);

if (pauseStatus)
{
lowlevelSystem.mixerSuspend();
}
else
{
lowlevelSystem.mixerResume();
}
}
}

我们游戏用在Unity下用Fmod,有个奇怪的问题,在ios系统,闹钟响的时候,上划关闭闹钟,然后游戏就没有声音了

  • You must to post comments
Best Answer
0
0

It looks like interruptions don’t trigger the OnApplicationPause callback in Unity, but OnApplicationFocus does handle this.

I have tested and submitted a fix for this which will be in the next release.
In the mean time you can find the fix on our Github repo.

https://github.com/fmod/UnityIntegration/commit/e25292e48d13c4e94dad176716de58c541c66a21

  • luzay341

    As we tested, the interruptions don’t trigger OnApplicationPause or OnApplicationFocus.
    I add your fix to my project, it does’t work, the OnApplicationPause and OnApplicationFocus callback can’t be triggered.

  • Cameron Baron

    That is strange, I have been testing the alarm interrupt and it was triggering the Focus callback.

    Can you provide some more information:
    – Unity version
    – FMOD version
    – Testing device

  • luzay341

    Unity 2017.2.0p4
    FMOD Studio Unity Integration: 1.10.02
    Device: iPad mini2, iPhone 8 plus, iPhone 6 Plus …
    iOS:11.2,9.4,10.x
    Most ios device have the problem.

    Thanks!

  • Cameron Baron

    If the OnApplicationFocus isn’t being triggered then there may be an issue with Unity.
    https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnApplicationFocus.html

  • luzay341

    Thanks!
    I’ll send it to Unity!

  • You must to post comments
0
0
  • luzay341

    Thanks!
    Is there any suggestions for unity else?

  • Cameron Baron

    What is the strange problem you are seeing?

  • luzay341

    This is the code in Unity, but it can’t be called when alarm clock actived and unactived.
    When alarm clock is active, the game goes silent.
    When alarm clock is closed with the game is not in background, the game keep silent.
    I’m looking for any API can be called in Unity when alarm clock actived or unactived, and the result is OnApplicationPause and OnApplicationFocus have some relation with the problem, but there can’t be called when alarm clock actived or unactived.
    I hava seen the suggestions in https://www.fmod.com/resources/documentation-api?page=content/generated/platform_ios/basics.html#/, but it is the suggesstions for ios develop, not for unity.

    This is the Code in Unity!!!

    RuntimeManager.cs

    void OnApplicationPause(bool pauseStatus)
    {
    if (studioSystem.isValid())
    {
    // Strings bank is always loaded
    if (loadedBanks.Count > 1)
    PauseAllEvents(pauseStatus);

    if (pauseStatus)
    {
    lowlevelSystem.mixerSuspend();
    }
    else
    {
    lowlevelSystem.mixerResume();
    }
    }
    }

  • You must to post comments
0
0

This is the code in Unity, but it can’t be called when alarm clock actived and unactived.
When alarm clock is active, the game goes silent.
When alarm clock is closed with the game is not in background, the game keep silent.
I’m looking for any API can be called in Unity when alarm clock actived or unactived, and the result is OnApplicationPause and OnApplicationFocus have some relation with the problem, but there can’t be called when alarm clock actived or unactived.
I hava seen the suggestions in https://www.fmod.com/resources/documentation-api?page=content/generated/platform_ios/basics.html#/, but it is the suggesstions for ios develop, not for unity.

This is the Code in Unity!!!

RuntimeManager.cs

void OnApplicationPause(bool pauseStatus)
{
if (studioSystem.isValid())
{
// Strings bank is always loaded
if (loadedBanks.Count > 1)
PauseAllEvents(pauseStatus);

            if (pauseStatus)
            {
                lowlevelSystem.mixerSuspend();
            }
            else
            {
                lowlevelSystem.mixerResume();
            }
        }
    }
  • luzay341

    There is no problem in Android system.

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.