All values are empty when returning to previous layer

All values are empty when returning to previous layer
0.0 0


Hi everyone I have a problem that is very difficult to explain. I am creating a pause screen for my game. The pause screen is just another layer. When the pause button is pressed everything is paused and the pause layer is displayed. When the user clicks resume the pause layer removes itself from its parents and fires of an “unpause” function in my game scene. The unpause function simply sets a “pause” boolean to false. The problem is that when I return to the game it is as if all the memory has been released as it cannot read or write to the memory block where the pause boolean is stored. I put breakpoints in and find that during the unpause function only non of my variables have any values at all. if i put nothing in the unpause function the game does continue and works perfectly and all values are as they should be (some things do not work however, as they rely on paused being false). I am very confused and have absolutely no idea why this is happening.

The code that does the “unpausing” and also fires the “unpause” function in my game scene.

void pauseLayer::resumGame(){
    CCLOG("resume game pressed");


    GameScene* GS = Singleton::Instance()->returnGameScene();


My unpause function in my gamescene.

//unpause the game
void GameScene::unpause(){
    paused = false;

All help is greatly appreciated!


Could you also post your “pause” function? Why do you pause the whole Director?