While Oculus Quest supports bluetooth keyboard, it’s valuable for an immersive app to let users interact with a system keyboard by keeping them engaged in the experience, without context switching away from the app. The keyboard overlay feature lets you display the system keyboard as an overlay on an app to facilitate text entry, which reduces the need for you to develop your own custom-built keyboard experience. It offers the same set of capabilities such as voice dictation, smartphone input, and multiple language support.
Use Oculus Integration package v19.1, or higher
Note: If you’ve recently upgraded to Oculus Integration v19.1 package, restart your Oculus device to use the keyboard overlay functionality.
When you set up the system keyboard to appear as an overlay, it automatically appears when an editable UI text element receives the input focus. When the app displays the keyboard, it loses the input focus, triggering the
OVRManager.InputFocusLost event. When the app closes the keyboard, it gains the input focus, triggering the
There are two ways you can enable the system keyboard: using the project setting from Unity or invoking the system keyboard programmatically.
OVRManager surfaces the keyboard overlay project setting to easily display the system keyboard as an overlay on your app.
To show the system keyboard programmatically, leverage the Unity’s TouchScreenKeyboard interface.
Declare a variable to store the TouchScreenKeyboard instance and a variable to hold the string the keyboard returns.
private TouchScreenKeyboard overlayKeyboard; public static string inputText = "";
When a text UI element receives focus requesting keyboard input, call the
TouchScreenKeyboard.Open() method to invoke the keyboard. Doing so takes input focus away from the app, triggering the
OVRManager.InputFocusLost event. The keyboard overlay features supports the default keyboard type only.
overlayKeyboard = TouchScreenKeyboard.Open("", TouchScreenKeyboardType.Default);
To retrieve the typed contents, call the
TouchScreenKeyboard.text property to return the text displayed in the input field of the keyboard and store it in the variable to use it elsewhere.
if (overlayKeyboard != null) inputText = overlayKeyboard.text;
To test or preview the keyboard overlay feature, do the following:
Point the cursor in the editable UI text element.
You can see the system keyboard overlay on the app.