2021-03-15 13:27:02 +01:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
public class HideandLockCursor : MonoBehaviour
|
|
|
|
{
|
2021-05-18 21:40:41 +02:00
|
|
|
[SerializeField] private bool _hideOnStart;
|
|
|
|
|
2021-03-15 13:27:02 +01:00
|
|
|
// Start is called before the first frame update
|
|
|
|
void Start()
|
2021-05-18 21:40:41 +02:00
|
|
|
{
|
|
|
|
if (_hideOnStart) HideCursor();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void HideCursor()
|
2021-03-15 13:27:02 +01:00
|
|
|
{
|
|
|
|
Cursor.visible = false;
|
|
|
|
Cursor.lockState = CursorLockMode.Locked;
|
|
|
|
}
|
|
|
|
|
2021-05-18 21:40:41 +02:00
|
|
|
public void ShowCursor()
|
2021-03-15 13:27:02 +01:00
|
|
|
{
|
2021-05-18 21:40:41 +02:00
|
|
|
Cursor.visible = true;
|
|
|
|
Cursor.lockState = CursorLockMode.None;
|
2021-03-15 13:27:02 +01:00
|
|
|
}
|
|
|
|
}
|