title: How do you store a GameScene so I can transition back to it from an InGame Menu?
body: <p>Hello fellow programmers. Here is the scenario. There is an InGameMenuScene that the user can access during the game that allows them to access settings and such. One of the buttons, BackToGame, on the InGameMenuScene should take you back to the GameScene you were originally on. I'm needing help figuring out how to store a GameScene and then accessing stored GameScene when the BackToGame button is clicked. I tried storing it in the UserDefaults, but I'm having problems accessing it again in the InGameMenu. </p>
  
  <p>Current GameScene:</p>
  
  <pre><code>func menuButtonPressed(){
  let savedScene = BInNYGameScene.self
  let userDefaults = UserDefaults.standard
      userDefaults.set(savedScene, forKey: "CurrentScene")
      userDefaults.set(count, forKey: "CurrentCount")
      userDefaults.set(hitCount, forKey: "CurrentHitCount")
      userDefaults.synchronize()
  }
  </code></pre>
  
  <p>InGameMenuScene:</p>
  
  <pre><code> func backToGame(){
      let userDefaults = UserDefaults.standard
      let backToGameScene = userDefaults.object(forKey: "CurrentScene") as! SKScene
      let nextScene = backToGameScene(size: scene!.size)
      nextScene.scaleMode = .aspectFill
      scene?.view?.presentScene(nextScene, transition: transition)
  
  }
  </code></pre>
  
  <p>Please let me know if there is a better way to store the GameScene and retrieving the GameScene. Thank you!</p>