Version: 2021.2
言語: 日本語
public static string TextField (string text, params GUILayoutOption[] options);
public static string TextField (string text, int maxLength, params GUILayoutOption[] options);
public static string TextField (string text, GUIStyle style, params GUILayoutOption[] options);
public static string TextField (string text, int maxLength, GUIStyle style, params GUILayoutOption[] options);

パラメーター

text 編集するテキスト。この関数が返す値は以下の例のように同じ変数に格納しなおすべきです
maxLength 文字列の最大の長さ。省略した場合は無制限に入力することができます
style 使用するスタイル。省略された場合は、現在の GUISkin にある textArea スタイルを使用します
options 指定してレイアウトオプションを渡すときのレイアウトオプションのリスト。ここで設定したものは style によって設定された値を上書きします。
See Also: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.

戻り値

string 編集された文字列

説明

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


Text field in the GameView.

using UnityEngine;

public class ExampleScript : MonoBehaviour { string stringToEdit = "Hello World";

void OnGUI() { // Make a text field that modifies stringToEdit. stringToEdit = GUILayout.TextField(stringToEdit, 25); } }