Geoff H
Geoff H

Reputation: 3257

How to Pause SpriteKit scene upon press of Siri Button on the Siri Remote for AppleTV tvOS

There seems to be a bug with AppleTV. I have a SpriteKit scene with an SKNode 'worldNode' that contains all game nodes (and actions). I am able to detect when the Menu button is pressed on the Siri Remote and so in the SKScene I call

worldNode.paused = true

This pauses everything under worldNode as expected, including actions. Now, to detect when the Siri Button is pressed my understanding is that applicationWillResignActive gets triggered in AppDelegate. So inside applicationWillResignActive I post a notification with

NSNotificationCenter.defaultCenter().postNotificationName("ApplicationWillResignActive", object: nil)

The notification is received by my SKScene with the received notification's respective selector triggering worldNode.paused = true However, this does NOT pause everything under worldNode like it does when called normally from within the scene! I find some actions nested under worldNode are still running!

Is there a work around? Is this a bug?

Upvotes: 3

Views: 194

Answers (1)

Wes
Wes

Reputation: 1042

In your scene when the Menu Button is pressed call:

self.scene!.view!.paused = true

and use:

self.scene!.view!.paused = false

to resume.

Upvotes: 1

Related Questions