text | Text to edit. |
keyboardType | Type of keyboard (eg, any text, numbers only, etc). |
autocorrection | Is autocorrection applied? |
multiline | Can more than one line of text be entered? |
secure | Is the text masked (for passwords, etc)? |
alert | Is the keyboard opened in alert mode? |
textPlaceholder | Text to be used if no other text is present. |
Opens the native keyboard provided by OS on the screen.
The autocorrection
determines whether the input tracks unknown words
and suggests a more suitable replacement candidate to the user,
replacing the typed text automatically unless the user explicitly
overrides the action.
The multiline
determines if user can input more than one line of
text.
The secure
identifies whether the keyboard is used for password. Text
in the input field will be hidden from the user except the recently
typed character.
The keyboard can be opened in the alert
mode too.
The placeholder
string will be displayed when there is no other text
in the input field of the keyboard.
var inputURL : String = "http://www.unity3d.com"; private var keyboard : TouchScreenKeyboard; // Opens native keyboard optimized for URL entry function OnGUI() { if (GUI.Button(Rect(0, 10, 200, 32), inputURL)) keyboard = TouchScreenKeyboard.Open(inputURL, TouchScreenKeyboardType.URL); if (keyboard) inputURL = keyboard.text; }
using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { public string inputURL = "http://www.unity3d.com"; private TouchScreenKeyboard keyboard; void OnGUI() { if (GUI.Button(new Rect(0, 10, 200, 32), inputURL)) keyboard = TouchScreenKeyboard.Open(inputURL, TouchScreenKeyboardType.URL); if (keyboard) inputURL = keyboard.text; } }
import UnityEngine import System.Collections public class ExampleClass(MonoBehaviour): public inputURL as string = 'http://www.unity3d.com' private keyboard as TouchScreenKeyboard def OnGUI() as void: if GUI.Button(Rect(0, 10, 200, 32), inputURL): keyboard = TouchScreenKeyboard.Open(inputURL, TouchScreenKeyboardType.URL) if keyboard: inputURL = keyboard.text