Search code examples
swiftsprite-kitskscene

Loading a new SKScene for the first time lags


I'm making a game a game in Xcode 6 using SpriteKit and swift. When I transfer from my starting scene to my "Play Game Scene" for the first time it takes 5 to 10 seconds. I have tried going to this scene from various other scenes and I still get this same lag. I thought it was the code at first, but this problem only recently started, but also, after I go to this scene the first time (and it lags), then I transfer to a different scene (the game over scene), when I go back to it, it no longer lags. It only lags the first time I transfer to this scene. I have also tried making a new project and copying and pasting all of the code from all of the scenes to a new scenes. If there is a simple explanation for this, please help. I don't understand why it would only lag the first time I go to the scene. If there isn't a simple answer, I suppose I will have to read through all of the code...AGAIN. Any help is appreciated. Thanks!

-Callum


Solution

  • 8 months later I came back to the project and found out it was because I use a non-specific font name. The font I used was "Felt Marker", but it should have been "Felt Market-Thin". If you don't give an exact font name, it takes a few seconds to figure out it was not specific so it goes to the default.

    Here is a list of all the IOS fonts with their specific types:

    http://iosfonts.com/