第一种方式
public InputField mainInputField;
// Activate the main input field when the scene starts.
void Start ()
{
mainInputField.ActivateInputField();
}
第二种方式
public InputField mainInputField;
// Activate the main input field when the scene starts.
void Start ()
{
EventSystem.current.SetSelectedGameObject(mainInputField.gameObject);
}
使用isFocused属性判断当前InputFiled是否处于焦点位置
出处:好久以前的文章