- Home /
TextField plus Return Key issue
I have a TextField that represents the user´s login info, a button to make the login but I also want the Return key to do the same as the button. The problem is that it will only work if I click outside of the TextField for once it´s focused, Input.GetKey(KeyCode.Return) will no longer work.
I am aware of GetNameOfFocusedControl and FocusControl but I was unable to use any of those together with Input.GetKey(KeyCode.Return).
Any suggestions?
Thanks!
Answer by Kleptomaniac · Mar 13, 2012 at 01:04 PM
Hey there,
Very similar question was answered here recently. Don't worry, there's no need for GUI.FocusControl (although you'll probably need it eventually :D) ...
Hope this helps, Klep
I used this Input.eat$$anonymous$$eyPressOnTextFieldFocus and it worked as I wanted. But thanks anyway!
Answer by unimechanic · Jul 03, 2013 at 04:06 PM
Here is an example:
http://forum.unity3d.com/threads/188202-Simple-dynamic-list-editor