Have you already tried to add Debug.Logs to your code to see what is going on during runtime? Maybe this code-block does not get called when your player dies.
Ok, now we know that the code-block got executed. Have you already tried to click the game window once? Sometimes, if Unity loses the focus, the user input does not work as expected.
For testing purposes, create a new script and a new scene. In Update, toggle the Cursor.visible value via user input. A simple if-statement and its block should do the job. Then test the script in your scene. If that works, the issue must be somewhere in or near the HandleDeath method. If the toggling in the test scene does not either, there might be a general problem in Unity.
The Unity Standard Assets FPS controller interferes with the Cursor lock state (it sets it back to locked). You have to disable the controller as well. See this post
Ok bixarrio, thanks. That worked, except I changed “gameOverCanvas.SetActive (true); → gameOverCanvas.enabled = true” because it was giving me an error. Behaves as it’s supposed to now.
I’m curious to see what solution Nina comes up with because I am a bit worried if this soultion gives me issues in the future with something else.
I’m not going to check the issue with the cursor if bixarrio’s solution worked for you. From what I understood, the problem is still the zoom? Or did I misunderstood anything?
The problem was that the cursor was not becoming visible after dying.
Using the solution bixarrio referred to, it now appears after the player dies, as it should.