void Update() { if (Input.GetKeyDown(KeyCode.T)) { #if !UNITY_EDITOR if (transparent) { Camera.main.backgroundColor = Color.green; WindowApi.Opacify(); } else { Camera.main.clearFlags = CameraClearFlags.Color; Camera.main.backgroundColor = Color.clear; WindowApi.Transparentize(); } #endif transparent = !transparent; } else if (Input.GetKeyDown(KeyCode.E)) { if (monitoring) { MouseApi.Release(); KeyApi.Release(); } else { MouseApi.ObserveLeftMouseDown(() => Debug.Log("left mouse down")); MouseApi.ObserveLeftMouseUp(() => Debug.Log("left mouse up")); MouseApi.ObserveRightMouseDown(() => Debug.Log("right mouse down")); MouseApi.ObserveRightMouseUp(() => Debug.Log("right mouse up")); // accessibility permission is required KeyApi.ObserveKeyDown(code => Debug.Log($"key down: {code}")); KeyApi.ObserveKeyUp(code => Debug.Log($"key up: {code}")); } monitoring = !monitoring; } }
private void OnDestroy() { KeyApi.Release(); MouseApi.Release(); }
private void OnDestroy() { Debug.Log("Clear"); MouseApi.Release(); KeyApi.Release(); }