Get information about an active equipment item

EVG

Member
Good evening, please tell me how to get information about an active equipped item. I am using a First Person Controller and an inventory system together.
You need to get information about the item that is currently equipped through the code.
inventory.png
 
For the "Active" equipped items you can use the character inventory bridge to know the currently active item in a specific slotID:
Code:
var activeEquippedItemInSlot0 = characterInventoryBridge.GetActiveInventoryItem(0);

In this case the SlotID is the UCC ItemSet slotID, not the ItemSlotCollection slot index, they are not always the same.

If you are trying to get any soft equipped item (soft equipped are items the character has equipped but isn't active, i.e not in the characters hand).

To get any soft/active equipped item you can loop over the Equippable items:
Code:
var allEquippedItems = characterInventoryBridge.EquippableItemCollections.GetAllItemStacks();
for (int i = 0; i < allEquippedItems.Count; i++) {
    var item = allEquippedItems[i].Item;
    
    //Do stuff with the soft or active equipped item.
}

If you are trying to get the item of a specific ItemSlotCollection using the slot index you can do this:

Code:
// Get the Item Slot Collection within the inventory using Get Item Collection and cast it to its type.
var equipmentItemCollection = m_Inventory.GetItemCollection(m_EquipmentItemCollectionID) as ItemSlotCollection;

var itemInSlot = equipmentItemCollection.GetItemInfoAtSlot(slotIndex);

//Or by name
itemInSlot = equipmentItemCollection.GetItemInfoAtSlot(slotName);

You can learn more about ItemSlotCollections here:

and the characterInventoryBridge here:
 
  • Like
Reactions: EVG
@claudius_I
The third code sinppet I posted above is independent from the character controller. It allows you to get an item within a sepcifc slot index within an ItemSlotCollection:

Code:
// Get the Item Slot Collection within the inventory using Get Item Collection and cast it to its type.
var equipmentItemCollection = m_Inventory.GetItemCollection(m_EquipmentItemCollectionID) as ItemSlotCollection;

var itemInSlot = equipmentItemCollection.GetItemInfoAtSlot(slotIndex);

//Or by name
itemInSlot = equipmentItemCollection.GetItemInfoAtSlot(slotName);
 
Top