Sprite Kit game "hickup" when the first sound is played

sprite-kit

Solution

I have a similar problem so here is what I found so far (I don't know if it fixes the problem because I can't try it right now).

I think the problem is that you didn't preload the sound effect. So when it plays for the first time, it is loaded and then played. That is why your game freezes.

The solution is to preload the effect when you initialize your scene. You can find an example in this tutorial (scroll down to the part named "Gratuitous Sound Effects"). It is pretty clear and well explained.

Hope it helps.

Problem

In my sprite kit game I use a SKAction to play a mp3 file when two sprites did collide. While the game works fine I noticed a small "hickup" in the game the first time the sound should be played. The complete game stops for about half a second. Afterwards everthing is fine and all following sounds work as they should. I noticed this behavoir in the simulator and on my iPhone 5s just the same. What can I do to prevent this?

Original source