_on_Node_gui_input not working

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

I’m working on a chess clone. There is a Board node of type VBoxContainer with 8 children holding the board’s rows of type HBoxContainer, and each row has 8 children that are instances of a custom Square scene. I want to use the _on_Board_gui_event signal / function to make sure it’s code is only ran when mouse input happens within the Board. However, the function does not run at all.

This is the script for the Board:

extends VBoxContainer

var hovered_square : Node
var clicked_square : Node
var held_piece : Resource
onready var Cursor : Node = get_parent().find_node("Cursor")

# Connects each square's mouse_entered signal to Board
func _ready():
	for y in 8:
		var row : Node = get_node(str(y + 1))
		for x in row.get_child_count():
			var children : Array = row.get_children()
			children[x].connect("mouse_entered", self, "_on_Square_mouse_entered", [children[x]])

func _on_Square_mouse_entered(square):
	hovered_square = square
	print("entered " + hovered_square.name)

func _on_Board_gui_input(event):
	if event is InputEventMouseButton:
		if event.button_index == BUTTON_LEFT:
			clicked_square = hovered_square
			held_piece = clicked_square.piece
			print("clicked " + clicked_square.name + ", holding " + held_piece.name)

Is there a way to get _on_Board_gui_event to work like I want, or should I take a different approach to implementing this feature? Also, feedback on general code style / structure is welcome if you are willing to provide it :slight_smile:

:bust_in_silhouette: Reply From: EliTheBeeli

Got a solution!

The Square’s mouse_filter (under Mouse in Inspector) was set to Stop, which prevented the InputEvents from ever reaching it’s parents. Changing this to Pass fixed the issue.