Pause menu buttons doesn't work

Godot Version

4.3

Question

I’m currently working on a pause menu for my game. I made a pause menu UI and then wrote codes in it:

extends Control

func pause() -> void:
	get_tree().paused = true
	show()

func resume() -> void:
	get_tree().paused = false
	hide()
	
func _ready() -> void:
	hide()

func _process(delta: float) -> void:
	if Input.is_action_just_pressed("ui_cancel") && !get_tree().paused:
		pause()
		
	elif Input.is_action_just_pressed("ui_cancel") && get_tree().paused:
		resume()

func _on_resume_pressed() -> void:
	resume()

func _on_restart_pressed() -> void:
	get_tree().reload_current_scene()

func _on_exit_pressed() -> void:
	get_tree().quit()

After that I tried it and it worked except menu buttons. They are not even poping up when my mouse enters the area of buttons. I am really trying to make a pause menu for 2 days just because of this problem. Thanks for anyone will help.

(the pause menu UI is set to always process)

1 Like

hmm… Please send the image of 2d scene with button properties

image

1 Like

I mean show pls button properties

and try to wrap color rect in canvas layer and do the same with vboxcontainer and set for example canvas layer/color rect/ layer 1 and canvas layer/vboxcontainer/ layer 2 in canvas layer properties.

1 Like

image
like this
and this
image

1 Like

Thanks! That solved the problem. It really annoyed me until you replied :grinning:

1 Like

Explanation: your color rect was on the same layer as buttons so color rect overlayed your buttons. Np :smiley:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.