Issues with the pause menu

Godot Version

Godot 4


I’m trying to make a pause menu, but when i run the project, the pause menu is opened already, the resume button seems to loop it, the mouse is not being unlocked and the only option to close the menu is to press escape (set as “pause” in the input map).
Please help, I’m losing my sanity.
Here’s the code:

I’ve managed to fix the resume button issue, but the menu being opened on startup and mouse not unlocking is still an issue.
Here’s the edited code:

To hide the pause menu on startup:

func _ready():

To change the mouse mode when opening and closing the pause menu, you can move that logic into the pauseMenu function.

1 Like

the func _ready() did work, but the mouse is still hidden. I’ll go read up on how to properly use set_mouse_mode.
thanks a lot!

I fear it might be clashing with my camera script, I’ll have to look through it and check for sure tho.

ALRIGHT so it turns out it was the camera. I forgot to check if the game is paused or not, so the game was always locking the mouse for the camera to work. I added an if statement that checks if the game is paused first in the camera function, and now it works as intended!

1 Like