Item Info

Item Info is a struct that contains useful information about an item. To understand why it is useful it is important to understand the differences between, Item, Item Amount, Item Stack and Item Info.


The Item is the object that was created at runtime using an Item Definition. It can either be Unique/Common and Mutable/Immutable. In the case of Unique Mutable items, they are given a unique ID. Meaning there can never be two items with the same ID, therefore they are easily differentiable.

In the case it is Immutable the item will never change at runtime, therefore to reduce memory usage a single object is used. For example if an “Apple” is set as Immutable, the same “Apple” reference will be used everywhere, whether it is for a pickup, for the player inventory, for the shop, etc. Thefore it is impossible to differentiate between “Apple” items. That’s why Item Stacks and Item Info are useful as they will help determine the object reference.

Item Amount

An Item Amount is a simple struct with an Item and an amount. This gives us no more information about the item apart from a quantity. It is usually used for serializing the data in the inspector or attributes. For example the Inventory Item Collection Inspector shows a list of Item Amount.

Item Amount should not be confused with an Item Stack which is a class (not a struct) and requires an Item Collection.

Item Stack

An Item Stack is an object that stores an amount of an item amount. It is linked to an Item Collection, and shouldn’t be used without one.

Item Collections are made of a list of Item Stacks. The default Item Collection allows a single Item Stack per Item but in the case of the Multi Item Collection, there may be multiple Item Stacks per Item. For example you may have two stacks “5 Apples” and “10 Apples”. The “Apple” item cannot be differentiated since they are the same, but the stacks are different and each have their own reference. So for example if you wish to remove “3 Apples” you may choose to do so from the “5 Apples” or the “10 Apples” stack.

In some cases you’ll want to specify in which Item Stack the item should be added or removed, but sometimes you may not care or you might simply not have that information. That is one of the reasons we use Item Info which allow us to define an Item Amount with an Item Stack.

Item Info

Item Info is a struct which has the following information:

  • Item Amount: The Item and the amount.
  • Item Stack: The Item Stack where this item comes from or is going to.
  • Item Collection: The Item Collection where the item is coming from or is going to.

Item Info gives more specification about the items and where they came from. It has not only the Item Amount but also reference to an Item Stack and/or Item Collection.

For example imagine an Inventory with 2 Item Stacks:

  • Stack 1: “5 Apples”
  • Stack 2:“10 Apples”

Where apple is an immutable Item.  If you wish to remove “3 Apples” from Stack 2 you can specify an Item Info as such. When adding Items to an Item Collection you may also specify where the Item came from and in which Item Stack it should be added to.

In some cases the Item Amount and the Item Stack Item Amount might not match. For example if you have “5 Apples” and remove “3 Apples” using the Remove Item function the result will be a nullable Item Info (if the result is null that means no item was found to be removed):

  • Item Amount: 3 Apples (this is the amount that was actually removed).
  • Item Stack: 2 Apples (This is the Item Stack where the item was removed from).
  • Item Collection: The Item Collection with the Item Stack.

As another example if “7 Apples” are removed from an Item Stack with “5 Apples” the result will be an Item info:

  • Item Amount: 5 Apples (this is the amount that was actually removed).
  • Item Stack: Empty (This is the Item Stack where the item was removed from, since all the items from that stack where removed, it is no longer part of the ItemCollection and is returned to the pool).
  • Item Collection: The Item Collection where the item was removed from.


You may create your Item Info using combinations of Item, Amount, Item Stack and Item Collection. This can be done explicitly or implicitly.

new ItemInfo(itemAmount, itemCollection, itemStack);
new ItemInfo("MyItem", 1);
new ItemInfo(item, amount);
new ItemInfo(itemAmount);
new ItemInfo(itemStack);
new ItemInfo(itemAmount, otherItemInfo);
new ItemInfo(amount, otherItemInfo);
new ItemInfo(itemDefinition, amount);
new ItemInfo(otherItemInfo, amount);
new ItemInfo(amount, item);

Check out the Item Info source code for more constructors and implicit operators.