Immerse SDK
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Keyboard

The Keyboard prefab provides a convenient way to input complex data. Text can be entered directly into Input Field or events can be utilized for custom behaviors.

Physical version of the Keyboard prefab (requires the Interaction package)

Component

The Keyboard component provides a number of options for customization, which are detailed below.

Keyboard component as it appears in the Inspector

Property Description
Layout Keyboard layout
Key Prefab Prefab used when instantiating keys
Key Size Size of the keys
Spacing Spacing between the keys
Mode Controls the behavior for key presses (see below)
On Close Triggered when the close action is triggered

Modes

The Keyboard supports different ‘Modes’ which are suitable for different use cases.

Global

When a Keyboard is set to ‘Global’, when a key is pressed, the input is processed by the currently selected Input Field.

Linked

Input will only be processed by the linked Input Field when this mode is selected.

Property Description
Input Field Input Field to type into. This should be a ImmerseSDK.UI.InputField or ImmerseSDK.UI.InputFieldTextMeshPro

Custom

The custom mode is for when you want complete control over what each key press does. Instead of interacting with an Input Field, it will trigger different events on the component depending on the action of the key that was pressed.

Event Description
On Text Input Triggered when a character key is pressed
On Backspace Triggered when backspace action is triggered
On Return Triggered when return action is triggered

Layouts

Layouts can be easily customized with ScriptableObjects that can be swapped on the fly. Included in the package are the following layouts:

  • Qwerty
  • Qwerty (caps)
  • Symbols
  • Number pad
  • PIN Input

Qwerty layout

You can create a new Keyboard Layout from the menu Assets > Create > Immerse > Keyboard Layout. Once you have your asset, start by adding some rows, then for each of those rows you can start adding keys.

To add a spacer/padding to your layout, simply add a new key with the Legend Type ‘Empty’.