Unity – Scripting – OnGUI – Text Area
Videogames Development – Unity – Code GUI Objects – Input Text Area
Input Text Area
1. Assign the script to the Camera:
1 2 3 4 5 6 7 | #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);