Overlays and Input Focus
Updated: Jul 31, 2024
If an app does not support focus awareness, Meta will flag it with a warning when submitted to the Meta Horizon Store. We recommend enabling the focus awareness feature early in your development process to test how your app handles the loss of input and let the system UI appear as an overlay.
This guide describes using overlays and focus awareness in your Unreal apps for Meta Quest applications.
Overlays are a feature that enables the Meta Quest system interface, such as the Universal Menu, to appear over an application without requiring the app to close. These overlays allow users to access system features such as social menus, settings, and more, which helps keep users engaged in the experience. For overlays to display correctly, your app must be focus-aware.
Apps should query for status changes, such as losing input focus or the presence of system overlays. When an overlay appears, apps can then take appropriate action. For example, when the universal menu appears over an app, it can continue running but pause gameplay because it has lost input focus.
The Meta XR Unreal integration provides the following support:
- The ability to configure whether the application is input-focus aware.
- Input focus handling.
Applications are focus-aware by default
All Meta Quest apps must be focus-aware for the Store to accept them. Therefore, we’ve enabled focus awareness by default. This policy ensures users can reliably access the universal menu and system actions as overlays without interrupting the app.
User experience guidelines
To ensure your app operates smoothly with overlays, follow these guidelines:
- Application experience continuity: When a system UI appears, the app continues running. Users expect a seamless experience, even with overlays. For example, if a player climbs a ladder when the universal menu appears, they should maintain their grip rather than fall.
- Prevent the loss of progress: Users may expect the app to handle overlay content in a way that prevents losing progress. For fast-paced single-player games, consider pausing gameplay to prevent loss of a level. In multiplayer games, continue as usual to avoid disrupting other players’ experiences. Media consumption experiences should continue, as users often bring up the universal menu to multitask and expect playback to proceed while they handle secondary tasks.
- Hide input affordances and near-field objects: The system renders overlay UI in the user’s personal space of about two meters. Hide any input affordances or objects displayed closer than this distance, such as in-app menus, to prevent visual disparities.
- Adjust audio volume: Lower the volume or mute audio playback during gameplay to signal when users interact with the system UI instead of the app.
- Indicating presence to remote users: For multi-user experiences, notify nearby users when someone interacts with the system UI. This helps others understand why a user might seem unresponsive.
When an overlay appears (such as when the user presses the Meta button), the running application loses input focus, and the HasInputFocus
flag returns false
.
You can query the status of input focus using a Blueprint or code. You should perform this query once during every frame render cycle.
Use OculusLibrary::HasInputFocus
to query input status using Blueprints.
To query input focus status in C++, use code similar to the following:
ovrpBool HasFocus = ovrpBool_False;
if (OVRP_SUCCESS(ovrp_GetAppHasInputFocus(&HasFocus)))
{
return HasFocus == ovrpBool_True;
}
else
{
return false;
}
Ensure that your app takes the appropriate action when input focus is lost. Examples may include:
- Pause gameplay. When you do this, it is essential to remember that the system will display its UI on top of any app UI, and your app cannot accept input because it doesn’t have input focus.
- Hide the user’s input affordance, such as arms or hands
- For online/multiplayer games, indicate when the user focuses on the system UI, not the app.
When the user dismisses the overlay, the application regains input focus, and the HasInputFocus flag returns true. In this case, you can resume gameplay or show the user’s input affordance.
The following example illustrates a typical implementation of hiding tracked controllers when the focus switches from the VRCharacter Blueprint to the system overlay.
For the Store requirement and testing steps related to focus awareness, see
Quest VRC Input 4.