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!
答案 0 :(得分:-1)
访问场景所在的viewController
,即,如果您的gameScene在名为gameViewController
的viewController中:
let vc = gameViewController()
vc.view.isPaused = true
或
vc.GameScene.view.isPaused = true