user3435781
user3435781

Reputation: 61

SKScene randomly goes back to main menu

Hi in the game I have made it seems when I am playing the game, randomly the gameplay scene goes back to the main menu. This could be an issue beccuase of high score lose and so on. Any possibly known fixes for this?

Thanks

Upvotes: 0

Views: 47

Answers (1)

jseanj
jseanj

Reputation: 1569

- (void)viewWillLayoutSubviews{
    [super viewWillLayoutSubviews];

    SKView * skView = (SKView *)self.view;

    if (!skView.scene) {
        skView.showsFPS = YES;
        skView.showsNodeCount = YES;
        skView.showsPhysics = YES;

        // Create and configure the scene.
        SKScene * scene = [MyScene sceneWithSize:skView.bounds.size];
        scene.scaleMode = SKSceneScaleModeAspectFill;

        // Present the scene.
        [skView presentScene:scene];
    }
}

Add this method replace the "viewDidLoad" method in scene.m.

Upvotes: 1

Related Questions