Game controller issues in visionOS

Hi,

I'm building a windowed game in visionOS which requires a gamepad. And I'm using a PS5 controller for this case.

However, I found a few problems:

  • When looking at the window close button, and press X in the gamepad, the window will be closed. This can happen accidentally when the user is playing.
  • When press the PS button(the home button), I want my app to handle it, e.g. take the user to the title screen. But visionOS will always capture this input and opens the home screen(App Library).

How to avoid these 2 issues? Or in general, how to make the gamepad input only available to my app but not the visionOS system?

Hi @kevin_wang

Try using the .persistentSystemOverlays(.hidden) modifier on your window. This will hide the close button and window bar, preventing the user from inadvertently looking at them and activating them with a controller.

For your second question regarding capturing home button input on a PS5 controller, this is not currently possible. The home button will cause the user to back out of your app to the visionOS menu (similar to how it would work on a PlayStation 5). I recommend filing a feature request using Feedback Assistant to track any developments on this functionality.

Game controller issues in visionOS
 
 
Q