Unity – Scripting – OnGUI – Text Area

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

Input Text Area

1. Assign the script to the Camera:

#pragma strict

	var stringToEdit : String = "Hello World\nI've got 2 lines...";
	function OnGUI () {
		// Make a multiline text area that modifies stringToEdit.
		stringToEdit = GUI.TextArea (Rect (10, 10, 200, 100), stringToEdit, 200);
	}

2, Play and type text inside the Text Area

Statement:
GUI.TextArea (Rect (10, 10, 200, 100), stringToEdit, 200);
GUI.TextArea (Rect (x, y, x, y), text content, max lenght);