SKTexture/SKSpriteNode の回避策は次のとおりです。使いやすくするために、独自のクラスにラップすることもできます。覚えておくべきことは、self.view が nil でない場所でこれをレンダリングすることです...
SKLabelNode *labNode = [SKLabelNode labelNodeWithFontNamed:FONT_GAME];
labNode.fontSize = 30.0f;
labNode.fontColor = [SKColor whiteColor];
labNode.text = @"TEST";
SKTexture *texture;
NSAssert(self.view != nil, @"Can't access self.view so sorry.");
texture = [self.view textureFromNode:labNode];
DLog(@"texture: %@", texture);
if (texture != nil) {
texture.filteringMode = SKTextureFilteringNearest;
SKSpriteNode *spriteText = [SKSpriteNode spriteNodeWithTexture:texture];
DLog(@"spriteText.size: %@", NSStringFromSize(spriteText.size));
spriteText.anchorPoint = ccp(0, 0.5);
spriteText.position = ccp(0, 25);
[self addChild:spriteText];
[spriteText runAction:[SKAction repeatActionForever:[SKAction sequence:@[
[SKAction colorizeWithColor:SKColor.yellowColor colorBlendFactor:1 duration:1],
[SKAction colorizeWithColor:SKColor.yellowColor colorBlendFactor:0 duration:1],
]]]];
}
else {
DLog(@"Texture is nil!");
}