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.
The Keyboard component provides a number of options for customization, which are detailed below.
|Prefab used when instantiating keys
|Size of the keys
|Spacing between the keys
|Controls the behavior for key presses (see below)
|Triggered when the close action is triggered
The Keyboard supports different 'Modes' which are suitable for different use cases.
When a Keyboard is set to 'Global', when a key is pressed, the input is processed by the currently selected Input Field.
Input will only be processed by the linked Input Field when this mode is selected.
|Input Field to type into. This should be a
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.
|On Text Input
|Triggered when a character key is pressed
|Triggered when backspace action is triggered
|Triggered when return action is triggered
Layouts can be easily customized with ScriptableObjects that can be swapped on the fly. Included in the package are the following layouts:
- Qwerty (caps)
- Number pad
- PIN Input
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'.
Updated almost 2 years ago