void Update() { if (GameCursor.isActivated) { if (PauseMenu.isPaused || STBInput.GetAxis("HorizontalRotate") != 0 || STBInput.GetAxis("VerticalRotate") != 0) { Destroy(cursor.gameObject); } } else { if (!PauseMenu.isPaused && (Input.GetAxis("Mouse X") != 0f || Input.GetAxis("Mouse Y") != 0)) { if (cursor == null) { cursor = Instantiate(cursorPrefab); } } } if (GameCursor.isActivated) { Ray ray = thisCamera.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, 100, LayerMask.GetMask("CursorDetector"))) { cursor.transform.position = hit.point; } if (Input.GetMouseButtonDown(0)) { cursor.SetFocus(true); } if (Input.GetMouseButtonUp(0)) { cursor.SetFocus(false); } } }