create a box that player can type in it

Hi How i can create a box with a button that player can type in box and if player click on the button all of text send in unity as a variable ? sorry for my english


What you want to use is the built-in GUI Object GUI.TextArea

Details on how to implement this are at the link. Basically TextArea has a string association called "text." You can have a GUI.Button that "submits" this text to wherever you like through code. So something like:

void submitText() {
  string submittedText = myTextArea.text;

EZGUI, a commercial product, also has some nice low-draw-call text area functionality: