using Siri Remote menu button as pause

So, games should use the Menu button to pause/unpause the game -- not the Play/Pause button?


Ok -- I have my game set up to do this via the GCController.controllerPausedHandler, and it is pausing correctly when I press the Menu button during gameplay.


However, when I press it a second time to unpause, the game does unpause but then it goes on to pull me out of the game entirely and back to the Apple TV home screen. Why does it do that and how do I prevent it? I took a look at the DemoBots source code -- it does not have this problem -- but I couldn't make sense of it.


Thanks,

Bob

Take a look at this section of the App Programming Guide for tvOS:

https://developer.apple.com/library/prerelease/tvos/documentation/General/Conceptual/AppleTV_PG/WorkingwithGameControllers.html#//apple_ref/doc/uid/TP40015241-CH18-SW1


At the bottom is a section called "Determining the Destination of Controller Input". You'll want to use GCEventViewController to basically determine where the Menu button event is going to get handled - either by your GameController handlers, or by your UIApplication/UIKit. In the case above, it looks like UIKit is seeing the Menu event and exiting the application.

So the use of GCEventViewController is required?

I've derived my view controller from GLKViewController.

Is this unsupported for AppleTV, and should I switch to GCEventViewController instead?

Or can I somehow do multiple inheritance?

I'm on ObjC, btw.


Thanks,

Bram

So in case others hit this issue:


What I did was, stop using GLKViewController, and use GCEventViewController instead.

I made my view controller a GLKViewDelegate by setting GLKView.delegate to my controller class.


I also made a CADisplayLink object, but am not 100% sure this is strictly required.


Bram

Im have same issue. Im got the PauseHandler event, but its also quit the app as well. Does a real example exists how to do that. There is not much info or confuction how to do that correctly. Im wish there was a boolean to disable it, so you can quit the game more gracefull when needed.

I agree it is confusing. In particular, the controllerUserInteractionEnabled flag on GCEventViewController does not seem to do anything different whether I set it to true or false. Does it only affect "real" game controllers and not the Siri Remote?


In any case, here is how I solved this, I am not sure if it is the right way. I ended up ignoring the GCControllercontrollerPausedHandler flag, I don't set it to anything. I am not sure how it works with the other ways of reading the Pause/Play button.


Instead, I use GCEventViewController and pressesBegan:withEvent. Check the pressType for UIPressTypeMenu to handle your pause screen. I have found that when my GCEventViewController is the firstResponder, then the button will not pull out of the app to the home screen. It only does that when the GCEventViewController is NOT the first responder.


What I don't know is how to handle the situation if the user WANTS to exit the app to the home screen. I know that I can set the firstResponder to something else, and then the Menu button will leave the app, but from a UI perspective, you'd want the user to select a button on the pause screen that says "leave app" or something, then manually leave the app for the home screen rather than have them press MENU. I haven't found out how to do that yet. I guess you could put up text that says "press MENU to leave app" or something once that option is highlighted.

Pressing the Menu button on the main menu of the app is the standard way of exiting to the home screen.


You achieve this by calling the super versions of pressesBegan and pressesEnded from your specializations of them in your view controller.

Hi, So I know that this is 5 years too late. But I am running into this same issue. Are any of you able to find a solution. And if you did can you please make a sample project or just a small example. That would be really helpful.

I am experiencing this issue on the siri remote. And only sometimes on MiFi Controllers.
using Siri Remote menu button as pause
 
 
Q