My buttons are not working

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By treckyvoiceomg

here is the source code for my project

extends Control
func _ready():
$HBoxContainer/VBoxContainer/Button.grab_focus()


func _physics_process(delta): 
if $HBoxContainer/VBoxContainer/Button.is_hovered() == true:
	$HBoxContainer/VBoxContainer/Button.grab_focus()
func _on_Button_press():
get_tree().change_scene("res://text.tscn")

I cant seem to get the buttons to do anything. Any advice would sure help

Is the function on_Button_press actually connected to the button’s pressed signal through code or the editor (you should see a green icon next to it if it was connected through the editor).

exuin | 2020-10-11 23:32

Did you get it to work?

Skydome | 2022-07-11 19:26

hello I had this same problem today no matter what I did buttons would not respond to mouse click that is until I removed the canvas layer in my UI if you have one that might be what’s causing the problem I think it might be capturing your mouse input and not allowing the button to do that

Cyber-Kun | 2023-03-07 10:07

:bust_in_silhouette: Reply From: mdubaisi

If there is a node covering the button and the mouse filter of the node is set to stop it will block the mouse from clicking the button.
So the solution is to set the mouse filter to ignore.