Mixed Reality and HoloLens Keyboard Helper Classes — MRTK2
MRTK provides several experimental helper components to assist with launching and reading text from the System Keyboard.
Note that the system keyboard will behave according to the target platform's capabilities, for example the keyboard on HoloLens 2 would support direct hand interactions, while the keyboard on HoloLens (1st gen) would support GGV1. Additionally, the system keyboard will not show up when performing Unity Remoting from the editor to a HoloLens.
MixedRealityKeyboard
MixedRealityKeyboard
is a component that provides methods for launching and closing a system keyboard, as well as interacting with text entered by the keyboard.
How to Use
- Attach the
MixedRealityKeyboard
component to any object. - Call
ShowKeyboard(string text = "", bool multiLine = false)
HideKeyboard()
to show and hide the keyboard, and handle theOnShowKeyboard
,OnHideKeyboard
andOnCommitText
events to handle when the keyboard is shown, hidden, and when the enter key is pressed.
Input fields TMP_KeyboardInputField, and UI_KeyboardInputField
The TMP_KeyboardInputField
and UI_KeyboardInputField
classes are components that can be added to text input fields to automatically invoke the system keyboard when clicked and update the text input field contents as the user enters text.
How to use
- Create an input field for either UnityUI or TextMeshPro.
- Add the corresponding
TMP_KeyboardInputField
orUI_KeyboardInputField
component to the input field game object.
Prefabs for both UnityUI input fields and TextMeshPro (TMPro) input fields are available at "Assets\MRTK\Experimental\MixedRealityKeyboard\Prefabs"
An example of how the to use TMP_KeyboardInputField and UI_KeyboardInputField is at "Assets\MRTK\Examples\Experimental\MixedRealityKeyboard\Scenes\MixedRealityKeyboardExample.unity"