How do I add a small popup menu to my inventory?

Godot 4.2

I have a pretty basic inventory system with slots that get instanced on ready. The inventory gets populated with these slots.

I also have created a small context popup menu in a separate scene.
This menu has 3 items: Use, Help, and Drop.

What I want to do is whenever the player right clicks in the inventory, the menu opens for that slot and they can choose whether they want to use the item, read more help about it, or drop it. I’ve tried instantiating and adding the menu as a child of the slot but that wasn’t working. What should I do?

This is my inventory interaction function.

func on_inventory_interact(inventory_data: InventoryData, index: int, button: int):
	match [grabbed_slot_data, button]:
			grabbed_slot_data = inventory_data.grab_slot_data(index)
			grabbed_slot_data = inventory_data.drop_slot_data(grabbed_slot_data, index)
			grabbed_slot_data = inventory_data.drop_single_slot_data(grabbed_slot_data, index)

I followed this video for the entire system:

Any suggestions or advice greatly appreciated! Thanks :smiley:

You can add a Window node as a popup menu, when right click pressed it will show or popup, and make the position of it at mouse position

1 Like