Unity Workflow LibraryUWLAbout

Topic 11 · Audio

Mobile audio: session, mute and background

iOS audio session options, the mobile mute state and stopping the audio thread to save power.

iOS Player settings

From the iOS Player settings:

  • Mute Other Audio Sources: whether the app stops audio from apps running in the background; otherwise their audio keeps playing alongside the game. Ask the user which behaviour they want; a game whose music is optional often leaves the player's own music playing.
  • Prepare iOS for Recording: initializes the microphone recording APIs, lowering recording latency, but re-routes iPhone audio output via earphones. Enable it only when the game records.
  • Force iOS Speakers when Recording: sends output through the internal speakers even with headphones plugged in while recording.

Mute state and the audio thread

From AudioSettings.Mobile (iOS and Android):

  • stopAudioOutputOnMute = true stops the audio output thread when device media volume is 0 and restarts it after. The reference recommends it for apps with simple looped music and short effects, and calling StopAudioOutput when the player sets in-game volume to 0, to reduce power use.
  • muteState and the OnMuteStateChanged event report the device mute state.
  • The caveat: sounds playing when output stops resume from the same position, so they can fall out of sync with gameplay that kept running. Don't use it when audio must stay in sync with gameplay.

Memory on mobile

  • Use per-platform import overrides (the Android row in AUDIO-IMPORT-PER-PLATFORM on the import and memory page) and remember that each streaming clip carries about 200 KB of overhead (Audio Clip Import Settings).
  • Voice budgets per device class are on the voices page; measure them on a device.