New UI system. How to focus on input fields.

I’m checking out the new unity 4.6.0b17. It’s very similar to NGUI to use.

I’m using input fields and can’t figure out how to focus on a targeted input field if I click on some label anywhere on the screen which is meant to focus the targeted input field on click. I can’t seem to find any such method in the method drop down list for input fields (I’m using the event trigger component).

Any help would be appreciated. Thanks in advance.

You also may need to activate it for the cursor to show up:


After spending about an hour on this, for me, following seems to work:


be careful not to use Select() or ActivateInputField() inside awake methods… if so change them to Start.

Hi guys!

I was looking for that too, and I made this to get the visual focus and start typing on Unity 4.6b20:

EventSystem.current.SetSelectedGameObject(myInputField.gameObject, null);
myInputField.OnPointerClick(new PointerEventData(EventSystem.current));

I passed null to the BaseEventData parameter on SetSelectedGameObject, and I called the OnPointerClick by sending a new PointerEventData of the current event system.



try to disable the Image component, or change the alpha to 0