using UnityEngine; using UnityEngine.EventSystems; using TMPro; public class TabletToggle : MonoBehaviour { public GameObject tablet; void Update() { if (Input.GetKeyDown(KeyCode.T)) { TMP_InputField inputField = null; if (EventSystem.current != null && EventSystem.current.currentSelectedGameObject != null) { inputField = EventSystem.current.currentSelectedGameObject.GetComponent(); } if (inputField != null && inputField.isFocused) return; tablet.SetActive(!tablet.activeSelf); } } }