2

I've set up a minimalistic project here which simply adds a red square and - after tapping the screen - a light source lighting it. On simulator it runs fine, but on my iPhone 5 the square just becomes invisible as soon as the light source gets added to the node tree.

Can anyone test this on other, real devices and give feedback? Any solutions? It's driving me crazy.

Here's the scene's code:

SKLightNode* lightNode;

@implementation GameScene

-(void)didMoveToView:(SKView *)view {
    //Add some node to be lit
    SKSpriteNode* node = [SKSpriteNode spriteNodeWithColor:[UIColor redColor] size:CGSizeMake(100, 100)];
    node.position = CGPointMake(self.size.width/2.0, self.size.height/2.0);
    node.lightingBitMask = 1;
    [self addChild:node];
}

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    //Add a light node to light the object
    if (!lightNode) {
        lightNode = [SKLightNode node];
        lightNode.categoryBitMask = 1;
        [self addChild:lightNode];
    }
    lightNode.position = [((UITouch*)[touches anyObject]) locationInNode:self];
}

- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
    lightNode.position = [((UITouch*)[touches anyObject]) locationInNode:self];
}

@end
Larry
  • 205
  • 1
  • 9

1 Answers1

2

There seems to be a bug in iOS8. I've experienced the same problem and sent a bugreport to Apple. SKLightNode does not seems to work well on an iPhone5. I've tried on iPhone6 (ok), iPhone5s (ok), iPhone5 (not working - black screen), iPod5 (ok), iPad Mini Retina (ok), ipad2 (ok).

Parrarro64
  • 126
  • 3