My Game is in the GameScene and Menu in my MainMenu Scene.
I put the following code in the overridden touchesBegan
of the MainMenu Scene to present the GameScene:
let reveal = SKTransition.fade(withDuration: 0.5)
let NextScene = GameScene(size: self.size)
NextScene.scaleMode = SKSceneScaleMode.aspectFill
self.view?.presentScene(NextScene, transition:reveal)
But if I test it I get the following error:
fatal error: unexpectedly found nil while unwrapping an Optional value
I just don't understand why because in the GameScene I have the follow code in the GameOver function which works perfectly fine:
let reveal = SKTransition.fade(withDuration: 0.5)
let MainMenuScene = MainMenu(size: self.size)
MainMenuScene.scaleMode = SKSceneScaleMode.aspectFill
self.view?.presentScene(MainMenuScene, transition:reveal)
They are the exact same but only the one in the GameOver Function works, why?