using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.EventSystems; public class Tabable : MonoBehaviour { private void Start() { Debug.Log("this script is on: " + gameObject.name); } // Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Tab)) { Selectable next = system.currentSelectedGameObject?.GetComponent().FindSelectableOnDown(); if (next == null) { return; } if (next.gameObject.name == "ToggleRememberUsername_LoginScreen") { next = next.FindSelectableOnDown(); } if (next != null) { //Debug.Log("Selected : " + next.gameObject.name); InputField inputfield = next.GetComponent(); if (inputfield != null) inputfield.OnPointerClick(new PointerEventData(system)); system.SetSelectedGameObject(next.gameObject, new BaseEventData(system)); } } } private readonly EventSystem system = EventSystem.current; }