Sometimes the GUI part of Unity can get a bit complex. Here is a tip for the input-field for focus and submit:
To programmatically set focus to the input field:
EventSystem.current.SetSelectedGameObject(MyInputField.gameObject,
null);
MyInputField.OnPointerClick(new
PointerEventData(EventSystem.current));
For Enter/Return keyboard button click event:
public void
OnEnterPassword(string s)
{
if (Input.GetKeyDown(KeyCode.Return) ||
Input.GetKeyDown(KeyCode.KeypadEnter))
OnEnterPassword();
}
Comments
Post a Comment