Version: 5.3 (switch to 5.4b)
IdiomaEnglish
  • C#
  • JS

Idioma de script

Selecciona tu lenguaje de programación favorito. Todos los fragmentos de código serán mostrados en este lenguaje.

GUI.TextField

Sugiere un cambio

¡Éxito!

Gracias por ayudarnos a mejorar la calidad de la documentación de Unity. A pesar de que no podemos aceptar todas las sugerencias, leemos cada cambio propuesto por nuestros usuarios y actualizaremos los que sean aplicables.

Cerrar

No se puedo enviar

Por alguna razón su cambio sugerido no pudo ser enviado. Por favor <a>intente nuevamente</a> en unos minutos. Gracias por tomarse un tiempo para ayudarnos a mejorar la calidad de la documentación de Unity.

Cerrar

Cancelar

Cambiar al Manual
public static function TextField(position: Rect, text: string): string;
public static string TextField(Rect position, string text);
public static function TextField(position: Rect, text: string, maxLength: int): string;
public static string TextField(Rect position, string text, int maxLength);
public static function TextField(position: Rect, text: string, style: GUIStyle): string;
public static string TextField(Rect position, string text, GUIStyle style);
public static function TextField(position: Rect, text: string, maxLength: int, style: GUIStyle): string;
public static string TextField(Rect position, string text, int maxLength, GUIStyle style);

Parámetros

position Rectangle on the screen to use for the text field.
text Text to edit. The return value of this function should be assigned back to the string as shown in the example.
maxLength The maximum length of the string. If left out, the user can type for ever and ever.
style The style to use. If left out, the textField style from the current GUISkin is used.

Valor de retorno

string The edited string.

Descripción

Make a single-line text field where the user can edit a string.

	var stringToEdit : String = "Hello World";

function OnGUI () { // Make a text field that modifies stringToEdit. stringToEdit = GUI.TextField (Rect (10, 10, 200, 20), stringToEdit, 25); }
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); } }