I have two TMP_InputField in unity. I am trying to automatically focus on and activate the other once the first one has an input. I have tried the following but for some reasons, it's not working for me.
using UnityEngine;
using UnityEngine.UI;
using TMPro;
using UnityEngine.EventSystems;
public class FocusBox : MonoBehaviour
{
public TMP_InputField b1;
public TMP_InputField b2;
// Update is called once per frame
private void Update()
{
if (b1.isFocused)
{
if (b1.text.Length > 0)
{
b2.Select();
b1.DeactivateInputField();
}
}
Debug.Log("is b1 focused after : " + b1.isFocused);
}
}