Sound stutters and stops when coming back from background (iOS 7)

I have spent a significant part of the last few days trying to debug this, but I believe I can now confirm with a high degree of certainty that there is a problem with Unity sound on iOS 7.

This is what is happening:

When you have a Unity game with music playing, and you send it to the background and open it again, the sound stutters for a second or two, and in some cases (about 1 of 10) it stops completely and the only way to bring it back is by repeating the process.

I was able to confirm this with a completely bare bones Unity project (which I have sent as a bug report) and, to my surprise (and relief) I was able to reproduce it on another Unity game I happen to have on my device.

The stuttering is happening only on sound files that are set to “Stream from Disk”, but the other issue where the sound is lost completely happens also with “Compressed in Memory”

I can accept and understand the stutter, but the bug that causes sound to completely disappear is a more serious one (I believe they are related).

Has anyone else experienced this problem, and if so, is there a workaround?
Or - if Unity guys are reading this, is it known and there is a fix on the way?


Reproduction Case:

  1. Create an audio source from MP3 file, set it to Stream from Disk
  2. Add it as to an audio source in a scene, set it to auto play and loop.
  3. Deploy the project to iOS 7 device (tested on iPad 2 and Mini)
  4. Open the game on the device, you should hear the music
  5. Minimize it to the background and open it back again.
  6. You should hear the sound stutter and sometimes stops completely. In a heavier, real life project, this stops more often than in this demo project.

If you do not hear the stutter right away, try one of these variations:

  1. Minimize to background and open again faster, OR
  2. Minimize to background, open any other app, close it and reopen the game.

Related: Forums thread

Hi! We had the same problem, and resolved it by upgrading to the latest version of Xcode.