Develop
Develop
Select your platform

Integrating the OVRVirtualKeyboard Prefab

Virtual Keyboard Deprecation
Virtual Keyboard as a feature is being deprecated in favor of the system keyboard overlay in Unity.
Please see System Keyboard Overlay for instructions on enabling the system keyboard as an overlay in Unity.
The OVRVirtualKeyboard prefab makes it easy to embed a feature-filled keyboard into your VR games and applications.
  1. Create a new scene or open an existing one from your project.
  2. If the scene lacks an OVRCameraRig, go to the Project tab, search for OVRCameraRig, and drag the prefab into the scene.
  3. On the Hierarchy tab, select OVRCameraRig to open the Inspector tab.
  4. Follow Setup for using Virtual Keyboard to configure the OVRManager.
  5. On the Project tab, search for OVRVirtualKeyboard, and drag the prefab into the scene.
  6. Position and scale the keyboard in front of the OVRCameraPrefab. For example:
    • Pos: 0.0f, -0.3f. 1.0f
    • Rotation: 10.0f, 0.0f ,0.0f
    • Scale: 1.0f, 1.0f, 1.0f
  7. You are now ready to configure input controls.

Configuring a Simple Text Entry Field

The OVRVirtualKeyboard Inspector properties has a field for Text Handler which takes a Unity Input field (not a TextMesh Pro text input). To add one to your scene, follow these steps:
  1. Add a canvas to your scene.
  2. Configure the canvas as a World Space canvas in the Inspector panel for Canvas > Render Mode dropdown list.
  3. Position and scale the canvas in front of the OVRCameraPrefab. For example:
    • Position: 0.0f, 0.5f, 2.0f
    • Size: 100.0f, 100.0f
    • Scale: 0.01f, 0.01f, 0.01f
  4. From the Hierarchy, right click the canvas and add an input field via UI > Legacy > Input Field.
  5. On the Hierarchy tab, select OVRVirtualKeyboard to access its properties.
  6. Update OVR Virtual Keyboard > OVR Virtual Keyboard Input Field Text Handler > Input Field to InputField(Legacy)(InputField) that you recently added to the scene.

OVRVirtualKeyboard - Adding Controller Support

If your OVRCameraRig already has controller prefabs, skip to Configuring OVRController for OVRVirtualKeyboard.
To Add Controllers to OVRCameraRig
  1. On the Hierarchy tab, select and expand OVRCameraRig.
  2. Navigate to OVRCameraRig > Tracking Space > LeftHandAnchor > LeftControllerAnchor.
  3. On the Project tab, search for OVRControllerPrefab and then drag it into the LeftControllerAnchor object in the scene Hierarchy.
  4. Select the OVRControllerPrefab object you just added to the Hierarchy to open its Inspector.
  5. From the Inspector, under OVR Controller Helper set Controller to LTouch.
  6. Repeat the same steps for the right hand, under the RightControllerAnchor object, setting the Controller to RTouch.
To Configure OVRController for OVRVirtualKeyboard
  1. On the Hierarchy tab, navigate to the OVRVirtualKeyboard prefab to access its Inspector tab.
  2. On the Inspector tab, locate OVR Virtual Keyboard > Controller Input.
  3. Drag the LeftControllerAnchor from the Hierarchy into the Left Controller Root Transform field.
  4. Drag the RightControllerAnchor from the Hierarchy into the Right Controller Root Transform field.
  5. Set the Controller Direct Interaction and Controller Ray Interaction values to true as appropriate for the implementation.
  6. Configure the Controller Raycaster as needed.
    OVRVirtualKeyboard prefab

OVR Virtual Keyboard - Adding Hand Support

If your OVRCameraRig already has hand prefabs, skip to Configuring OVRHand for OVRVirtualKeyboard.
To Add Hands to OVRCameraRig
  1. On the Hierarchy tab, select and expand OVRCameraRig.
  2. Navigate to OVRCameraRig > Tracking Space > LeftHandAnchor.
  3. On the Project tab, search for OVRHandPrefab and then drag it into the LeftHandAnchor object in the scene Hierarchy.
  4. Select the OVRHandPrefab object you just added to the Hierarchy to open its Inspector tab.
  5. Update the following inspector properties:
    • OVR Hand > Hand Type to Hand Left.
    • OVR Skeleton > Skeleton Type to Hand Left.
    • OVR Mesh > Mesh Type to Hand Left.
  6. Repeat the same steps for the right hand, under the RightHandAnchor object, setting the hand type to Hand Right.
Configuring OVRHand for OVRVirtualKeyboard
  1. On the Hierarchy tab, navigate to the OVRVirtualKeyboard prefab to access its Inspector tab.
  2. On the Inspector tab, locate OVR Virtual Keyboard > Hand Input. Set the Hand Left and the Hand Right fields as OVRHandPrefab(OVR Hand).
  3. Set the Hand Direct Interaction and Hand Ray Interaction values to true as appropriate for the implementation.
  4. Configure Hand Raycast as applicable.
    The inspector tab in the OVRVirtualKeyboard prefab

Integrated OVRVirtualKeyboard Prefab in a VR application

Your VR games and applications with a successfully integrated OVRVirtualKeyboard prefab should look like the image below:
VR image with the Virtual Keyboard and Virtual Keyboard options
Did you find this page helpful?