I have the exact same problem as described here, however the proposed solution won't work. In short, when transitioning between scenes, the transition in between is skipped entirely because the presentee takes too long to load. Now I'm looking for a way to properly preload all contents of the scene. What I do is:
The first time a transition is triggered it is always skipped, all following attempts work as expected.
Here is an example of how I alloc/init and preload the scenes (upon launch):
self.menuScene = [[LEMenuScene alloc] initWithSize:self.bounds.size];
[self.menuScene preload];
whereby preload
is a category of SKScene:
- (void) preload {
NSMutableArray* allTextures = [[NSMutableArray alloc] init];
[self enumerateChildNodesWithName:@"//SKSpriteNode" usingBlock:^(SKNode *node, BOOL *stop) {
SKTexture* texture = ((SKSpriteNode*)node).texture;
if (texture) [allTextures addObject: texture];
}];
[SKTexture preloadTextures:allTextures withCompletionHandler:^{
//nop
}];
}
I am aware that the loading is carried out asynchronously and that preload
will return instantly (which is intended), so I could cause a transition before loading is finished, but it does not matter how long I wait, it always lags.
Any tips/help is greatly appreciated!
Turns out the issue wasn't the textures after all. I misspelled the name of a font, which made the system look for a suitable substitution, causing the delay.
Here's the same issue: How to cache or preload SKLabelNode font?