言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

GUILayout.TextArea

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static function TextArea(text: string, maxLength: int, style: GUIStyle, params options: GUILayoutOption[]): string;
public static string TextArea(string text, int maxLength, GUIStyle style, params GUILayoutOption[] options);
public static def TextArea(text as string, maxLength as int, style as GUIStyle, *options as GUILayoutOption[]) as string

Parameters

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

Returns

string 編集された文字列

Description

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


ゲームビューのテキストエリア

	var stringToEdit : String = "Hello World\nI've got 2 lines...";

	function OnGUI () {
		// Make a multiline text area that modifies stringToEdit.
		stringToEdit = GUILayout.TextArea (stringToEdit, 200);
	}
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    public string stringToEdit = "Hello World\nI've got 2 lines...";
    void OnGUI() {
        stringToEdit = GUILayout.TextArea(stringToEdit, 200);
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	public stringToEdit as string = 'Hello World\nI\'ve got 2 lines...'

	def OnGUI() as void:
		stringToEdit = GUILayout.TextArea(stringToEdit, 200)