How to add item attributes to the confirmation pop-up window?

Bai

New member
I want to display a specific attribute of an item in a pop-up window, for example: "Whether to use the 'Great Sword'". I know how to get the attribute value of an item through the manual, but I don't know how to get the currently clicked item.
index.php
屏幕截图 2025-03-20 223959.png
 

Attachments

  • 屏幕截图 2025-03-20 223403.png
    屏幕截图 2025-03-20 223403.png
    12.4 KB · Views: 11
So I'm assuming you are using an ItemViewSlotsContainer (InventoryGrid, Hotbar, etc...) for your UI. These have a function OnItemViewSlotClicked

So in an OnAwake or Start function you can listen to the event
Code:
m_InventoryGrid.OnItemViewSlotClicked += OnItemClicked;

Then you can handle that however you want:
Code:
protected virtual void OnItemClicked(ItemViewSlotEventData slotEventData)
{
    var item = slotEventData.ItemViewSlot.ItemInfo.Item;
}
 
Back
Top