void Update() { if (_instance == null) { return; } updateCursorLocation(); _instance.GetComponent <Image>().enabled = Cursor.visible; if (Application.isFocused && !VHVRConfig.UnlockDesktopCursor()) { // We'll lock the hardware cursor in place using this // system function. I found that using Cursor.lockState // was having side effects on mouse position/raycast calculations // and was messing up the simulated cursor behavior a bit. SetCursorPos(Screen.width / 2, Screen.height / 2); } }