- Home /
How I can make a string equal to a textfield?
I have a TextField which I want to write something on it, and that can be copied what you wrote in a string.Please help me.
thanks in advance
Answer by AliAzin · Aug 22, 2010 at 07:22 AM
you should do somthing like this:
var stringToEdit = "Hello World"; var finalString : String; function OnGUI () { // Make a text field that modifies stringToEdit. stringToEdit = GUI.TextField (Rect (10, 10, 200, 20), stringToEdit, 25); if (GUI.Button(Rect(0,0,50,50),"CopyText")) finalString = stringToEdit;
}
I did what you told me and gives me the error: The name 'string' does not denote a valid type. Did you mean 'System.Globalization.StringInfo' ?
Sorry, I should write "String" ins$$anonymous$$d of "string"
Your answer
Follow this Question
Related Questions
Display additional text before the variable that the user is editing in a GUI Text Field 1 Answer
GUI.TextField ToUpper? 1 Answer
Unity Shutdown 1 Answer
Allow only numbers in an input field 1 Answer
Impossible to write in GUI input field 0 Answers