StellarXipher/Assets/Puzzles/Word Puzzle/Scripts/TabletToggle.cs
nlevin6 cba7033371
Some checks failed
Build project / Build for (StandaloneWindows64, 6000.0.37f1) (push) Waiting to run
Build project / Publish to itch.io (StandaloneLinux64) (push) Blocked by required conditions
Build project / Publish to itch.io (StandaloneWindows64) (push) Blocked by required conditions
Build project / Build for (StandaloneLinux64, 6000.0.37f1) (push) Has been cancelled
fixed wordle
2025-03-29 23:50:49 -04:00

25 lines
663 B
C#

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<TMP_InputField>();
}
if (inputField != null && inputField.isFocused)
return;
tablet.SetActive(!tablet.activeSelf);
}
}
}