Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


TouchScreenKeyboard

Interface for on-screen keyboards. Only native iPhone, Android, and Windows Store Apps are supported.
Read time 2 minutesLast updated 5 days ago

Definition

  • Type: Class
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule
public class TouchScreenKeyboard

Remarks

This interface allows to display different types of the keyboard: ASCII, Numbers, URL, Email, and others.
Because the appearance of the keyboard has the potential to obscure portions of your user interface, it is up to you to make sure that parts of your user interface are not obscured when the keyboard is being displayed.
TouchScreenKeyboard.visible
and
TouchScreenKeyboard.area
should be used to determine if the keyboard is being shown (activated) and what portion of the screen is using.
Universal Windows Platform: On Universal Windows Apps the touch screen keyboard is supported when physical keyboard is not connected.
Note: Attempting to access any properties of this class on an unsupported platform throws an exception. If you're targeting multiple platforms, make sure your code checks TouchScreenKeyboard.isSupported before attempting to use it.

Properties

Property

Description

activeIs the keyboard visible or sliding into the position on the screen?
canGetSelectionSpecifies whether the TouchScreenKeyboard supports the TouchScreenKeyboard.selection property. (Read Only)
canSetSelectionSpecifies whether the TouchScreenKeyboard supports the TouchScreenKeyboard.selection property. (Read Only)
characterLimitHow many characters the keyboard input field is limited to. 0 = infinite.
selectionGets or sets the character range of the selected text within the string currently being edited.
statusReturns the status of the on-screen keyboard. (Read Only)
targetDisplaySpecifies on which display the on-screen keyboard will appear.
textReturns the text displayed by the input field of the keyboard.
typeReturns the TouchScreenKeyboardType of the keyboard.

Static Properties

Property

Description

areaIndicates the portion of the screen that is currently covered by the on-screen keyboard.
hideInputWill text input field above the keyboard be hidden when the keyboard is on screen?
inputFieldAppearanceReturns the current visibility status of the on-screen keyboard's input field. (Read Only)
isInPlaceEditingAllowedChecks if the text within an input field can be selected and modified while TouchScreenKeyboard is open.
isSupportedChecks if on-screen keyboards are supported.
visibleReturns true whenever any keyboard is visible on the screen.

Static Methods

Method

Description

OpenOpens the native keyboard provided by OS on the screen.

Classes

Class

Description

TouchScreenKeyboard.AndroidAndroid specific on-screen keyboard settings.

Enums

Enum

Description

TouchScreenKeyboard.InputFieldAppearanceOptions to define the visibility status of the on-screen keyboard's input field.
TouchScreenKeyboard.StatusThe status of the on-screen keyboard.