Return Multiple Categories From ItemIdentifiers

SteveC

Member
Hey y'all!

How do you return categories when an ItemDefinition has multiple categories or no category?

For example, this works just fine for ItemIdentifiers with only one Category:
C#:
List<IItemIdentifier> inventoryList = inventory.GetAllItemIdentifiers();
foreach (IItemIdentifier item in inventoryList)
{
    IItemCategoryIdentifier categoryIdentifier = item.GetItemCategory();
    Debug.Log("ItemCategory: " + categoryIdentifier);
}

But doesn;t return anything for multiple categories, or where Category equals "Nothing".

A good example would be:
Pistol - has one "Item" category, returns "Item"
Assault Rifle - has two categories, returns nothing
Assault Rifle Ammo - has no Category ("Nothing") and returns nothing

Looking through the documentation, I'm having trouble determining how to return this appropriately.

Please let me know what questions you have.

Thanks in advance!
 
You can cast the IItemIdentifier to an ItemType and then get all of the categories.
 
Top