Remove unitys standard 'ESC' Function Cursor - Windows

How do I disable the default function of Unity that Escape brings up the mouse.

As when I press escape it pauses the game, Freezes the character and movement and brings up a paused UI if I press Escape againto exit the pause menu the mouse disapears for a breif second and then pops back up, I do gain access to the player again, but for some reason the cursor will continue to display the mouse regarless if I set Cursor.visable = false;

Current code that handles pausing the game.

         if (isPaused && Input.GetKeyDown(KeyCode.Escape))
         {
             fpc.enabled = true;
             Cursor.lockState = CursorLockMode.Locked;
             Cursor.visible = false;
             pausedCanvas.SetActive(false);
             isPaused = false;
         } 
         else if (!isPaused && Input.GetKeyDown(KeyCode.Escape))
         {
             fpc.enabled = false;
             Cursor.lockState = CursorLockMode.None;
             Cursor.visible = true;
             pausedCanvas.SetActive(true);
             isPaused = true;
          }

Ok since you put up an example (without any code) I decided to quickly boot up my Unity test project and throw together a minimalistic FPS setup. A single script on a character controller capsule. The main camera is simply a child of the player. This is the result after a windows standalone build

As you can see by pressing the ESC button when in the menu I just set Cursor.visible to false and Cursor.lockMode to “Locked”. Everything seems to work as it should. Note that when testing inside the editor pressing the ESC button does not lock / hide the cursor again as mentioned in the comment above. However the build works as it should.

I used Unity version 2019.2.14f1. I’m on a Windows 10 64Bit machine (Intel i7 with a relatively old NVIDIA GeForce GTX 750 Ti).

I currently don’t have a running linux machine (beside my Raspberry PI server with rasperian) so I can’t test a linux build. I can not reproduce your issue. If you want any further help with your issue you have to provide much more information and much more details on your specific case.