我正在创建一个简单的MainMenu场景并在" play"按钮选择我按如下方式移动到游戏场景:
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
for (UITouch *touch in touches) {
CGPoint location = [touch locationInNode:self];
SKNode *node = [self nodeAtPoint:location];
if ([node.name isEqualToString:@"play"]) {
SKScene *gameScene = [[GameScene alloc] initWithSize:self.size];
SKTransition *fadeTransition = [SKTransition fadeWithColor:[UIColor blackColor] duration:0.3];
[self.view presentScene:gameScene transition:fadeTransition];
}
}
}
转换应用程序崩溃后,EXC_BAD_ACCESS(代码= 1)。我目前正在运行Xcode6 + SpritKit / Objective-C
答案 0 :(得分:1)
发现问题 - 显然是由粒子targetNode赋值引起的:
starParticle.targetNode = self.scene;
可能应该在呈现其他场景之前发布