blob: 3f3812cd67d06fa6938ce545cf286c861ead22bf (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class UnlockCursor : MonoBehaviour
{
public bool lockCursor = true;
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.F1))
{
lockCursor = !lockCursor;
}
Cursor.lockState = lockCursor ? CursorLockMode.Locked : CursorLockMode.None;
Cursor.visible = !lockCursor;
}
}
|