#InputField auto reselect after submitting

1 messages · Page 1 of 1 (latest)

finite citrus
#
public class KeyboardInputController : MonoBehaviour
{
    // 35
    public InputField inputField;
    public Controller controller;
    public TextMeshPro console;

    private void Update()
    {
        if (controller.consoleMode)
        {
            inputField.Select();
            inputField.enabled = true;
            inputField.readOnly = false;
            inputField.interactable = true;
            if (Input.GetKeyDown(KeyCode.Return))
            {
                console.text += inputField.text;
                inputField.text = "";
            }
        }
    }
}
#

as you can see I already tried to set some booleans and calling the select method but nothing worked...

lilac holly
#

Id not use inputfield for that because you don't really need it and it would be hard to change its core features when you want to make it work differently. You can just use Input.inputString to make your own input field type of system

finite citrus
lilac holly
finite citrus
#

thx