I want to pause my GameScene, when the app moves in the Background (HomeButton, Call, etc.). How do I pause the GameScene from the AppDelegate File?

时间:2019-03-17 22:37:00

标签: swift sprite-kit appdelegate pause

The File holds the function I need:

func applicationDidEnterBackground(_ application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. }

but I don't know how to reference the GameScene to pause it. My goal ist to stop everything inside the GameScene with the command:

self.view.isPaused = true,

but I can't reference the view :/ Thanks for help in advance!

1 个答案:

答案 0 :(得分:-1)

访问场景所在的viewController,即,如果您的gameScene在名为gameViewController的viewController中:

  let vc = gameViewController()
   vc.view.isPaused = true

   vc.GameScene.view.isPaused = true
相关问题