Roses/Assets/Scripts/ClickTest.cs
2024-04-12 15:40:45 +02:00

28 lines
No EOL
608 B
C#

using SatorImaging.AppWindowUtility;
using TMPro;
using UnityEngine;
public class ClickTest : MonoBehaviour {
[SerializeField] private TMP_Text text;
private int _presses;
private bool _pressed;
private const int Key = 0xBF;
private void OnEnable() {
AppWindowUtility.AlwaysOnTop = true;
}
private void Update() {
if (_pressed && Win32API.GetAsyncKeyState(Key) == 0) {
Debug.Log("unpressed");
_pressed = false;
return;
}
if (!_pressed && Win32API.GetAsyncKeyState(Key) != 0) {
Debug.Log("pressed");
_presses++;
text.text = _presses.ToString();
_pressed = true;
}
}
}