Last active
October 28, 2016 11:07
-
-
Save melv-n/65c7494ecbacf11ea4910100d446f54e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| using UnityEngine.UI; | |
| using System.Runtime.InteropServices; | |
| public class Main : Button { | |
| #if UNITY_WEBGL | |
| [DllImport("__Internal")] | |
| private static extern void SendClientHeartbeat(string _msg); | |
| #endif | |
| void OnGUI() { | |
| if (Input.GetKeyDown(KeyCode.Escape)) { | |
| Cursor.lockState = CursorLockMode.None; | |
| Cursor.visible = false; | |
| } | |
| } | |
| public override void OnPointerDown(UnityEngine.EventSystems.PointerEventData eventData) { | |
| Cursor.lockState = CursorLockMode.Locked; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment