Enable Keyboard Overlays for Text Input with Unreal Engine
The Quest system shows an on-screen keyboard overlay when a text field in the Home environment receives focus. For example, when a user selects the search option.
You can also display the system keyboard on top of your apps to enable user text entry with a familiar and consistent interface. The keyboard overlay provides voice dictation, smartphone input, and multiple language layouts. Note that the keyboard overlay supports all languages listed in Settings > System > Language and Region > Language. A user can also change the keyboard language once it displays by clicking the world icon to the right of the space bar.
The following image shows an example of the English keyboard overlay the system displays when a user clicks on a Search bar.
Integrate keyboard overlay support
You can use a setting to automatically display the keyboard overlay when the user selects a text field or manually display the keyboard.
You must have the Meta XR plugin installed.
Note: If you’ve recently upgraded your Meta XR plugin, you may need to restart your Meta Quest device to use the keyboard overlay functionality.
You must have Focus Awareness enabled. This setting is on by default; however, you can verify it is enabled in the Unreal Editor by navigating to
Edit >
Project Settings >
Plugins >
Meta XR >
Mobile >
Focus Aware. For more information, see
Overlays and Input Focus.
Enable the system keyboard with a project setting When you enable the system keyboard, it will automatically appear when an editable UI element receives input focus. For example, if you enable the system keyboard and a user clicks a textbox in your app, the system keyboard will appear automatically.
To enable the system keyboard, make the following changes:
Navigate to Edit > Project Settings > Platforms > Android > APK Packaging, and ensure Enable improved virtual keyboard is selected. The following image shows this setting.
Navigate to Edit > Project Settings > Plugins > Meta XR and check Requires System Keyboard. This will add an entry (oculus.software.overlay_keyboard
) to the app manifest, telling the runtime to use a VR keyboard. The following image shows this setting.
With the settings enabled, when the keyboard displays, the app loses input focus, meaning the HasInputFocus
flag returns false
. Focus is returned to the app when the keyboard is closed.
Manually display the system keyboard You can call the Unreal
FSlateApplication::ShowVirtualKeyboard
function to display the system keyboard manually. Similar to the keyboard setting, when you display the keyboard manually, the app loses input focus, and the
HasInputFocus
flag returns
false
. Focus is returned to the app when the keyboard is closed.
To test or preview the keyboard overlay feature, do the following:
- Open the app in which you’ve implemented the keyboard overlay feature.
Point the cursor in the editable UI text element.
You can see the system keyboard overlay on the app.