I am creating a FPS game and when you click the “Start” button on my menu screen it enables the pointer lock and a message of “Hit Esc to show your cursor” comes up at the top of the screen (similar to “Hit Esc to exit full screen mode” when watching a video). And then, when I want to get to the start menu again, I have to hit Esc twice, once to disable the cursor lock, and twice to actually pull up the menu. However, the first Esc should be unnecessary because I already have a line that disables the cursor lock when you hit Esc and pulls up the start menu at the same time.
My guess is that the browser consumes the Escape key event when unlocking the cursor so PlayCanvas never gets the event to react to.
I would either use a different key (M for example) or have some code that checks the state of the cursor lock (https://developer.playcanvas.com/en/api/pc.Mouse.html#isPointerLocked) every frame and when it is unlocked, (last frame was locked, current frame unlocked), show the menu UI.