Version: 2017.2
public UI.InputField.ContentType contentType ;

描述

指定输入文本内容的类型。

ContentType 会影响字符验证、使用的键盘类型(在具有屏幕键盘的平台上)、InputField 是否接受多个行,以及文本是否会自动校正(在提供输入自动校正的平台上),或是否会被视为其中的字符不直接显示的密码。

using UnityEngine;
using System.Collections;
using UnityEngine.UI; // Required when Using UI elements.

public class Example : MonoBehaviour { public InputField mainInputField; public string playerName;

void Start() { //Changes the character limit in the main input field. mainInputField.characterLimit = playerName.Length; } }