Unity – Scripting – OnGUI – Input Text Field

Videogames Development – Unity – Code GUI Objects – Input Text Field

Input Text Field

1. Assign the script to the Camera:

#pragma strict

        var stringToEdit : String = "Hello World";
	function OnGUI () {
		// Make a text field that modifies stringToEdit.
		stringToEdit = GUI.TextField (Rect (10, 10, 200, 20), stringToEdit, 25);
	}

2, Play and type text inside the Text Area

Statement:
GUI.TextField (Rect (10, 10, 200, 20), stringToEdit, 25);
GUI.TextField (Rect (x, y, x, y), text content, max lenght);