Version: 2017.1
public static string TextField (Rect position, string text);
public static string TextField (Rect position, string text, int maxLength);
public static string TextField (Rect position, string text, GUIStyle style);
public static string TextField (Rect position, string text, int maxLength, GUIStyle style);

パラメーター

position 表示位置
text 編集するテキスト。この関数が返す値は以下の例のように同じ変数に格納しなおすべきです
maxLength 文字列の最大の長さ。省略した場合は無制限に入力することができます
style 使用するスタイル。省略された場合は、現在の GUISkin にある textField スタイルを使用します

戻り値

string 編集された文字列

説明

ユーザーが文字列を編集することができるテキストエリア

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public string stringToEdit = "Hello World"; void OnGUI() { stringToEdit = GUI.TextField(new Rect(10, 10, 200, 20), stringToEdit, 25); } }