Hey, There
I got a problem with my script and can’t figer out what the problem is.
What I want: That the cursor hide and locked at the beginning and wen you press a key it wil show the cursor and show the PauseMenu
using UnityEngine;
using System.Collections;
public class Pause : MonoBehaviour {
[Header("PauseKey")]
public KeyCode pause;
[Header("PauseObjects")]
public GameObject PauseMenu;
void Start ()
{
Cursor.visible = false;
Cursor.lockState = CursorLockMode.Locked;
}
void Update (){
if (Input.GetKeyDown (pause))
PauseMenu.SetActive (!PauseMenu.activeSelf);
Cursor.visible = true;
Cursor.lockState = CursorLockMode.None;
}
}