How to unlock screen after UI popup?
Hi,
I've been having trouble with getting my screen to lock when a UI menu pops up. I recently got help with getting it to lock...but now it won't unlock after the menu has gone...
Also, to get the locking to work I had to make a whole new script, for some reason it wouldn't work as part of my original script - I don't know if that is an issue, just thought I should mention.
So this is my pause manager script (where I figure the coding should go but it doesn't work there) :
void Start() { canvas = GetComponent(); canvas.enabled = false;
     playerLook = (MouseLook)GameObject.Find("FPSInput").GetComponent("MouseLook");
 }
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         Pause();
     }
    
 }
 public void Pause()
 {
     canvas.enabled = !canvas.enabled;
     Time.timeScale = Time.timeScale == 0 ? 1 : 0;
     playerLook.enabled = !playerLook.enabled;
    
 
               And this is the script that I get to lock the screen. I can see it doesn't unlock because I don't have an option for that, but nothing I try works and I've just gotten completely confused:
public GameObject player;
     void Update()
     {
         if (Input.GetKeyDown(KeyCode.Escape))
         {
         GetComponent<MouseLook>().enabled = false;
     }
         if (Input.GetKeyDown(KeyCode.M))
         {
         GameObject.FindWithTag("FPS").GetComponent<MouseLook>().enabled = false;
     }
       else
     {
 
               I appreciate any (and all) help! Thanks you!
Your answer
 
             Follow this Question
Related Questions
Unity UI Text enable and disable by a C# Script? 2 Answers
Attaching a worldspace ui to an object? 0 Answers
TextMeshPro DropdownMenu thru code. 1 Answer
Rotating UI RawImage while moving it upwards 1 Answer
Best way to simplify this code 1 Answer