Pressing menu goes back to tvOS home screen even with controllerUserInteractionEnabled set to false

I seem to be getting inconsistent results, and I wonder if it has to do with using presentScene(_ scene: SKScene, transition: SKTransition).


Sometimes when I hit the menu button, it is handled in my controllerPauseHandler code as expected, but sometimes it goes back to the Apple TV home screen. The B button always seems to behave correctly, and is handled in my code instead of going to the home screen. My view controller is a subclass of GCEventViewController, and the controllerUserInteractionEnabled is set to false. I actually never change it to true in my tests.


class GameViewController: GCEventViewController {...}


Any thoughts on if there is something I need to do after presentScene is called, or something I can research?


Thanks

Replies

I've got this in my GameScene...


tapMenu.addTarget(self, action: #selector(GameScene.tappedMenu))
tapMenu.allowedPressTypes = [NSNumber (value:  UIPressType.menu.rawValue)]
self.view!.addGestureRecognizer(tapMenu)


And the function it calls just handles pausing and unpausing the game...


@objc func tappedMenu(){
      
        if (self.isPaused == true) {
          
            //run code to unpause
          
        } else {
          
            //run code to pause
        }
      
      
    }


But I remove that gesture recognizer when the game is on the main menu. So without the recognizer, the default functionality is that pressing Menu goes back to the Apple TV home screen. Which is what Apple has suggested we do. You aren't supposed to make it difficult to get out of your app =)