Skip to content

Lifecycle (Unity)

For audio you may want to mute/unmute under your control (e.g. when the platform asks the game to mute, or when you want to silence audio while an ad shows). The SDK exposes a small audio API on the top-level FRVRSDK class — it manipulates Unity’s AudioListener.volume for you:

FRVRSDK.MuteVolume();             // saves current volume, sets AudioListener.volume = 0
FRVRSDK.UnmuteVolume();           // restores the saved volume
FRVRSDK.SetVolume(0.5f);          // clamped 0..1
float v   = FRVRSDK.GetVolume();
bool muted = FRVRSDK.IsMuted();

These calls don’t fire automatically — your code (or the channel host via SendMessage to the SDK singleton’s MuteVolumeInstance / UnmuteVolumeInstance / SetVolumeInstance) decides when to mute.

  • Audio imports. Mute compliance on iOS requires every AudioClip imported with specific settings — see Unity quickstart § 3. Audio. This is the one lifecycle‑adjacent thing that breaks if you skip it.
  • Run in background must be OFF. Project Settings → Player → Resolution and Presentation. If it’s on, Unity will keep running under an ad overlay — double‑consuming audio channels and CPU, and breaking the focus-driven pause described above.
  • Mute audio yourself around ads. Because the wrapper does not auto-mute, you may want to call FRVRSDK.MuteVolume() in your interstitial / reward onStart and UnmuteVolume() in onFinish / onError, especially if “Run in background” can’t be guaranteed off on every channel build.

If you need to react to pause/resume in game code

Section titled “If you need to react to pause/resume in game code”

Use Unity’s built‑in hooks — they’ll fire because the wrapper is using the same signals:

void OnApplicationPause(bool paused)
{
    if (paused) StopAmbientLoops();
    else        ResumeAmbientLoops();
}

void OnApplicationFocus(bool hasFocus)
{
    // hasFocus == false means the tab/app was backgrounded or an ad opened
}

Don’t try to proxy these to FRVRSDK.Lifecycle.* — there’s no such API in the Unity wrapper, and it’d duplicate work the wrapper is already doing.