Pause menu problem in godot 4.2.2

Godot Version

4.2.2

Question

Hello everyone. I have a little problem running a pause menu. This is the code i am using. Its all ok and it pause but when i hit again it does not unpause the game like the elif does not recognise it at all.

if Input.is_action_just_pressed("ui_cancel"):
	get_tree().paused = true
	pause_menu.visible = true
elif Input.is_action_just_pressed("ui_cancel"):
	get_tree().paused = false
	pause_menu.visible = false

Thats probably because this script is paused as well. You have to set the process mode of this node/script to “always”

its on always and still got the problem

Since you use the same condition in both cases, it will never get to the elif branch.

2 Likes