Forum Discussion

WolfMaNeMattOfficial's avatar
5 months ago
Solved

Open Custom UI Panel Via Button Press

Im not sure if this was asked already but how would one go about using the quest controller specific buttons (A,B,X,Y) to open up a ui panel in a horizon world ?

Example: When Y is pressed then menu interface shows up, when Y is pressed again the interface closes

3 Replies

  • What you are looking for is to register callback events for custom player inputs. These need to run as local scripts typically with a default manager to handle the assignments. Once registering an input such as PlayerInputAction.LeftSecondary for the Y button, the callback event will run any time that button is pressed or released. Here is the documentation page to help you get started.
    https://developers.meta.com/horizon-worlds/learn/documentation/create-for-web-and-mobile/typescript-apis-for-mobile/custom-input-api 

  • We also _just_ got an api recently to force a mobile/web player to 'focus in' on a spatial Custom UI via the Player.focusUI() method.  You could use PlayerControls to watch for a magic button and then force them to focus in.  Or, if using an overlay Custom UI, you could just show/hide the whole UI (but take care w/ overlay UI, as it doesn't always work very well for VR users).