- Home /
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:
Create an audio source from MP3 file, set it to Stream from Disk
Add it as to an audio source in a scene, set it to auto play and loop.
Deploy the project to iOS 7 device (tested on iPad 2 and Mini)
Open the game on the device, you should hear the music
Minimize it to the background and open it back again.
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:
Minimize to background and open again faster, OR
Minimize to background, open any other app, close it and reopen the game.
Related: Forums thread
I'm having this exact same problem (music is lost on soft exit and restart) and I have the latest XCode verison. Did you ever find a workaround for this?
No workaround, it seems to be a bug, Unity are aware of it. If you can also submit a bug report I guess it could only improve the chances for a fix in the next build.
Answer by andykscott · Sep 27, 2013 at 06:56 PM
Hi! We had the same problem, and resolved it by upgrading to the latest version of Xcode.
Hi DannyB, I'm having the same problem... and I just update to xcode5, but it didn't resolve the sound issue. Just wonder have you found a solution to fix this yet?
$$anonymous$$any Thanks
Not yet. See the forum thread - it seems to be a reproducible Unity bug, so not much to do other than wait for a fix I guess.
Thanks for the reply Danny. :) And Hope they will fix it for the next update. Cheers
Your answer
Follow this Question
Related Questions
IOS 9 - Sound is not working. 0 Answers
Game skips frames when a sound is played on iOS 0 Answers
Text rendering bug. Shows black squares. -1 Answers
iOS 2d game some sprites artifatcs on edges 1 Answer
I can not build for IOS simulator 0 Answers