I have the following composer structure in ny game:
playGame (regular scene) --> youDiedPleaseTryAgain (overlay scene) --> playGame (regular scene)
When the user touches the retry button in youDiedPleaseTryAgain , the following code executes:
composer.hideOverlay() composer.removeScene("playGame") composer.gotoScene("playGame")
The reason that I want to remove/recreate playGame is to avoid having to remember to reset everything, seems more safe to just recreate.
At “removeScene”, only the destroy() function in playGame is called, which is normal I guess. But at “gotoScene” the hide() function in playGame is called and NOT the create() function as I would have guessed. The problem is that since playGame no longer exists, I get errors for trying to access stuff that are nil in the hide() function.
Why is the hide() function in playGame called at all? How should I reset a scene from an overlay like in the example above?