x


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!

more ▼

asked Mar 13 '12 at 12:52 PM

cj_coimbra gravatar image

cj_coimbra
351 12 16 17

(comments are locked)
10|3000 characters needed characters left

1 answer: sort newest

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

more ▼

answered Mar 13 '12 at 01:04 PM

Kleptomaniac gravatar image

Kleptomaniac
2.5k 6 11 21

I used this Input.eatKeyPressOnTextFieldFocus and it worked as I wanted. But thanks anyway!

Mar 13 '12 at 01:10 PM cj_coimbra
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3698
x957
x151
x78

asked: Mar 13 '12 at 12:52 PM

Seen: 1047 times

Last Updated: Mar 13 '12 at 01:10 PM