I have a sample project here where I created a UI menu linked to a fps script scene.
I have 3 problems that I could not solve that causes errors with the pointerlock controls.
Problem 1: When pressing Escape to bring the pause menu inside the game scene if I press continue quickly sometimes the pointerlock will not enable as you can see in the video below on the second try.
Problem 2: When spam clicking around the canvas in when the game is paused I disable the movement and camera scripts however sometimes the camera moves randomly please see video below
Problem 3: Please see video below when going to main menu from the game scene the pointerlock enables in the main menu for some reason I do not know why. I tried to disable it always on the main menu but for some reason that does not work.
Maybe the solutions is simple but I think I confused my self too much and cannot fix these errors for some reason. I tried using application events to make it better but I could not get this to work with my limited knowledge on events. Thanks for any help.