I’m making a simple hangman game in 4.6 and I’ve got pretty much everything done, but the player has to click the InputField in order to type in it, and when they submit, the InputField is deselected. I tried to select the field again using SetSelectedGameObject
EventSystemManager.currentSystem.SetSelectedGameObject (inputField,null);
but I get the error
Argument #1' cannot convert UnityEngine.UI.InputField’ expression to type `UnityEngine.GameObject’
I’m assuming this is because most of the new UI elements aren’t counted as GameObjects yet.
Is there a way to make sure the InputField is always selected so the player can type in it, or at least doesn’t deselect when the player submits?
PS, this is the code I’m using for submiting
inputField.onSubmit.AddListener((value) => SubmitGuess(value)); submitButton.onClick.AddListener(() => SubmitGuess(inputField.value));
It deselects the InputField in both types of submission.