title: Save state of GameScene through transitions
body: <p>I want to build an inventory for my SpriteKit game. For this I want to go to another SKScene File which represents my inventory when I press the pause button. My problem is that when I make a transition from my InventoryScene back to my GameScene, the GameScene loads completely new. This is the transition code from my GameScene class:</p>
  
  <pre><code>func loadInventory(){
      if !transitionInProgress{
          transitionInProgress = true
          if let scene = InventoryScene(fileNamed: "Inventory"){
              Globals.InventoryGlobals.levelBeforeSwitch = currentLevel
              scene.scaleMode = .aspectFill
              let transition = SKTransition.push(with: .down, duration: 0.5)
              self.view?.presentScene(scene, transition: transition)
          }
      }
  }
  </code></pre>
  
  <p>With this code I'll go to my InventoryScene.</p>
  
  <p>Now in my InventoryScene I want to go back to my GameScene with this:</p>
  
  <pre><code>func loadLevel(level: String){
      if !transitionInProgress{
          transitionInProgress = true
          if let scene = GameScene(fileNamed: level){
              scene.currentLevel = level
              scene.scaleMode = .aspectFill
              let transition = SKTransition.doorsOpenHorizontal(withDuration: 1)
              self.view?.presentScene(scene, transition: transition)
          }
      }
  }
  </code></pre>
  
  <p>The transitions are working but my problem is that the GameScene loads completely new, which is obviously because I instantiate a new GameScene. So when the player is in the middle of the level and then goes to the Inventory and back to the GameScene, the player is back at the beginning of the level. If I go from the Inventory back to the scene I want to be the GameScene as it was before (player position, enemy health, etc.)</p>
  
  <p>Has anyone an idea how i can do this?</p>