ios - SKLabelNode delays app start -
At this time I'm coding a small app with Spritekit, which works perfectly well, but only one problem is SKLabelNode That is, I started with the following common pieces of code:
one. Self.scoreLabel = [SKLabelNode labeled nodivith fonts named: @ "Futura"]; Self.scoreLabel.fontSize = 190.0f; Self.scoreLabel.color = [SKColor whiteColor]; Self.scoreLabel.alpha = .2; Self.scoreLabel.text = @ "00"; Self.scoreLabel.position = CGPXMake (Screenshoot / 2, self .core labell.fr. size.height / 2); [Self compound: self.scoreLabel]; There are many more things to get started, but they do not affect anything. If I comment on the above code, then the app loads in the normal time, it is loading with SKLabelNode a few seconds ...
Hope someone can help me.
You need to pre-fill the font so that when you first call your SKEEN Pure Kit If already, the font is ready in memory already. The best way to do this is by app representatives or singletons as you can use in your sports life cycle.
self.scoreLabel = [SKLabelNode labelNodeWithFontNamed: @ "Futura"]; Self.scoreLabel.text = @ "preload"; You do not need to make the label global, just to make sure that you keep a strong reference to the compiler to determine that this font should be kept in memory. Also make sure that you set up a text property (when you set it, the font is only loaded).
Edit:
This is what I am using:
- (zero) Setup font {SKLabelNode * preloadFontLabel = [SKLabelNode label Nodivith fonts nominated: @ "helvetia new-ultralight"]; [PreloadFontLabel setText: @ "preload"]; } This game is called singleton when the game starts, I also have a call-back which closes the "play" button before the assets are loaded. So that the user does not jump until the gun is up and full. There is no problem loading only 1.03secs in my game's assets, but if you want, you can also hide a long load behind the splash / startup screen.
If your problem is still being watched then I'll check you in your SKScene with no other fonts that are not your predecessor This may be an issue with loading the custom font, try changing the font to "helvetia new-ultrite" and see if you have the same problem.
Comments
Post a Comment