Gui_input signal connection issue

Godot Version

4.2.2

Question

Im having and issue with my gui signal not responding at all. So this is my gui_input function its the standard one, where i connected it via the engine.

Blockquote

func _on_gui_input(event: InputEvent) → void:
if event is InputEventMouseButton
and event.is_pressed()
and grabbed_slot_data:

	match event.button_index:
		MOUSE_BUTTON_LEFT:
			drop_slot_data.emit(grabbed_slot_data)
			print("drop data")

Blockquote
This is the tree im working in, so i setup the signal from the InventoryInterface to the InventoryInterface. But when i run it, it doesnt even print my printline. So how do i check so the signal works and is running? I can see the green icon in the script but thats about it. (Im pretty new to godot)
image

gui_input only gets called when the mouse is inside the “invenoryinterface” and nothing is “above” the inventory. I think if your mouse is inside one of the child nodes it blocks the signal from emitting

1 Like

Well the child nodes are in the corners just to make sure they dont get "clicked on " if i can refer it like that. So it doesnt matter where i click on the screen im getting no reaction at all. But is there a way that i can check if the function actually gets executed?

Well a print() in the beginning of the method would be the obvious test

Yeah did that before and nothing, so i guess the issue lies somewhere else then?

Try other signals of the node, like: “mouse_entered”, “mouse_exited”

I tried both entered and exited with prints in both and non of it works. Is it because its a controll node? I got no clue what could be the problem.

Whats the size of your control-node?

0x0 pixels, since its just a controll node with a script that controlls my PlayerInventory and ExternalInventory(a chest) and items that are grabbed. But shouldnt the exit and enter work on its children then or have i miss interpted it?


This is how it looks in the game

No i dont think this works on the children

Because right now, its my controll node script that sets and gets the data (item) from the items slots so when i grabb and item i actually got the data from the child. But now when i try to “drop” the data on the screen it doesnt work but when i drop it normaly i the inventory its no problem so its kinda weird

So you want to check if an item is dropped on the screen (outside the inventory)?

First i check if there is a mouse action inside the inventory if so i wanna check if a action is pressed and then if an item(in this case data) is grabbed and if all is true i wanna check if mouse_button_left is clicked and if it is just print() so i can see that it works. But right now i dont even get a print in the start of the function so its never getting called

you probably have to check that in the inventory-scene itself

image
image


This is how the scenes look and even if i move my mouse across the screen everywhere nothing ever gets registered.

Connect the signal from the InventoryScene and not the InventoryInterface-Scene