HomeGuides
HomeGuidesLearn about the Immerse SDK installerLog In

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.

938938

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.

479479

Keyboard component as it appears in the Inspector

Description
LayoutKeyboard layout
Key PrefabPrefab used when instantiating keys
Key SizeSize of the keys
SpacingSpacing between the keys
ModeControls the behavior for key presses (see below)
On CloseTriggered 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.

Description
Input FieldInput 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.

EventDescription
On Text InputTriggered when a character key is pressed
On BackspaceTriggered when backspace action is triggered
On ReturnTriggered 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
412412

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'.