Button to drop/equip item doesnt work in my inventory

Godot Version

4.5.1

Question

Hello , so i have made an inventory and i added an menu to the items , so that when i have an item in the inventory and i click on it the menu pops up next to it. The menu consists of 2 buttons for now , drop and equip . when i open the menu of the first item in the inventory the dop button is kinda higher than the inventory and it works , but the equip button (which is in the inventory when i open it up) doest seem to work , when i swap their position the drop button stops working, what is wrong?



Equip button doesn’t seem to be having any signal connections.

i know but the button itself doesnt work , it doesnt light up or anything , and there is a really small space where it does work

Does it work if you run the menu scene alone?

It’s likely the same problem as:

yes it does work when i run the menu scene alone , how do i fix it?

Read the thread I linked.

oh okay , thanks!

i messed around with the mouse fliters etc and i still have that problem, i think ive tried everything

Don’t have the menu scene inside item or slot scene. Instantiate it separately over those scenes.

i mean i created the menu scene separately and than i instantiated them on to the slot

Does every slot have its own menu, or is there one menu instanced on top of all of the slots?

i think one menu is instanced on top off all slots

Do you have a photo of the node tree for the inventory? i want to compare it to mine, i agree with normalized. this sounds like the same problem i had.

is this okay?
btw i tried to do everything myself so it may looks messy etc , and im not sure if i screenshotted the correct thing lol

No. This scene structure is precisely the cause of your problem. UI elements that catch mouse clicks in other slots are laid over the buttons in your item menu. So events are consumed before they reach those buttons. That’s why your upper button is working and the lower one is not. There are no other slots laid over that upper button, at least not for the first row of slots.

thank you for the explanation , but how should i fix it?

I already wrote it above. Also two ways to handle this are described in the discussion I linked.

Don’t keep your item menu inside slots. Instantiate that scene via script code every time you need it and put it into the scene tree after all slots. That way it’ll be first to get the events.

The other solution is to set slot mouse filter to “pass” or “ignore”, for all slots, whenever the menu is shown.

Depending on your setup you may get away with having everything that captures mouse events set its mouse filter to “pass”.

Read up on mouse event filtering to understand how mouse events are propagated across the nodes in the scene tree.

1 Like

thank you i will try that!