I want to Pause and Unpause a Scene in SpriteKit, with 2 Buttons on the same position. While the Scene is running, I want to show the \'Pause\' Button. While the Scene is p
You can't update the button (or anything else in the scene) while the SKView is paused. In your touchesBegan
method, you are pausing the view before updating the button (changing the order won't work). You will need to return to the run loop so your button is updated before pausing the game. Here's one way to do that:
This calls a method to pause the view after a short delay. Add this after your [self Resume]
statement in touchesBegan
, and delete self.scene.view.paused = YES
.
[self performSelector:@selector(pauseGame) withObject:nil afterDelay:1/60.0];
This method pauses the SKView. Add this to your MyScene.m
- (void) pauseGame
{
self.scene.view.paused = YES;
}