An Inventory owns the Item Collections used by a player, Shop, chest or pickup. Start with Bag for general storage and Equipment for fixed equipment slots. Collections hold Item Stacks; Item Restrictions control additions and removals.

Create the owner and collections

  1. Add Inventory to the owning GameObject. Select the scene’s Version 1 Inventory System Database in the Inspector’s Database context; the Inventory System Manager supplies the active runtime database.
  2. Add Inventory Identifier when UI, saving or interaction must find this owner by ID. Assign a stable, unique, non-zero ID; its default is 1.
  3. Under Item Collections, add the following rows. Give every collection a unique name because name lookups use the first match.
Collection Collection Type Purpose Starting Item Amounts
Bag Item Collection Main 3 Health Potion and 1 Iron Sword.
Equipment Item Slot Collection Equipped Empty when the character starts unequipped.

Inventory.AddItem targets MainItemCollection. An explicit Main makes this predictable; with none assigned, the first collection becomes Main. Use Multi Stack Item Collection when common Items need several bounded stacks.

Inventory Identifier registers during Awake and resolves Inventory, Currency Owner and Item User on its GameObject. Use distinct serialized IDs for every player, chest or persistent owner, then verify the UI resolves the intended one.

The legacy Version 1 Inventory Inspector showing the database context, Item Collection Restriction Objects, Main and Equipped collections, Item Amounts, and the selected Item attributes; current releases label the top field Database.

Configure Bag and starting Items

Select Bag and add Items under Item Amounts. The picker supports c:Consumable for a direct category, a:Attack for an attribute, and iron i:Weapon a:Attack for a name fragment combined with inherited category and attribute filters.

Default Item Amounts load after all collections initialize. In Play Mode the Inspector shows live Item Stacks instead. Keep references in the active database. When switching databases, use Convert Inventory Objects only when those references should be replaced by equivalents in the selected database.

Configure Equipment

Assign an Item Slot Set with a Weapon slot accepting Iron Sword’s Weapon category. Assign a valid category to every slot. Keep New Item Priority and Try Give Previous Item To New Item Collection off for the initial workflow; both default to off.

Use the Move To Collection Item Action to exchange Items between Bag and Equipment. The action removes the incoming Item before adding it, preserving a mutable unique sword’s identity and Durability. Follow Item Slot Collection for UI, Equipper and save bindings.

Add acceptance and overflow rules

The base collection has no capacity limit. Create Create > Ultimate Inventory System > Inventory > Item Restriction Set, add concrete restriction types, then assign the asset under Item Collection Restriction Objects. Keep targeted collection names synchronized with the Inspector.

Requirement Restriction
Accept only Consumable Items in Bag Item Collection Category Restriction.
Limit occupied stacks across named collections Item Collection Stack Amount Restriction.
Limit the amount in a stack Item Collection Stack Size Restriction.

At runtime the Inventory duplicates assigned restriction objects and finds same-GameObject components implementing IItemRestriction. It evaluates restrictions in order: null rejects; a smaller returned Amount allows a partial operation. Custom restrictions implement Initialize, CanAddItem(ItemInfo, ItemCollection) and CanRemoveItem(ItemInfo).

Overflow Options Default Configuration
Return Overflow Off Enable only for a deliberately managed return to the collection carried by the incoming ItemInfo.
Invoke Rejected Event On Observe requested, accepted and rejected ItemInfo values.
Overflow Action None Assign the project’s rejection response.

For moves requiring complete acceptance, require CanAddItem to return the full Amount before removing from the source. Keep Return Overflow off when the caller measures accepted Amounts and returns the remainder itself. For automatic return policies, inspect destination state or per-stack add events to measure acceptance.

Route incoming Items automatically

Keep Bag as Main for ordinary pickup and equip flows. For category-based intake, create Intake as an Item Transaction Collection, make it the only Main, and list Bag then Equipment as destinations. Restrict Bag to Consumable so it leaves Weapon Items for Equipment.

Use exact destination names, direct routes into storage collections, Prevent Adding When No Match on, and full-request acceptance rules. Configure Return Real Added Item Amount according to the caller’s accounting. See Item Transaction Collection for the complete routing and overflow policy.

Verify the Inventory

  1. Enter Play Mode and select Bag. Confirm its live Item Amounts contain 3 Health Potion and 1 Iron Sword.
  2. Pick up or purchase another potion. Confirm Bag and its UI increase by the same amount.
  3. Equip Iron Sword. Confirm the same runtime Item leaves Bag and occupies Equipment’s Weapon slot; Health Potion must be rejected there.
  4. If Intake is Main, add both definitions through Inventory.AddItem. Confirm each reaches its first compatible destination and an unmatched Item is rejected.
  5. Check UI, interaction and save lookups against the owner’s stable Inventory Identifier.

Use the Inventory API

Carry ItemInfo when the origin or exact stack matters. Removal results report the removed Amount; use the overflow policy above when interpreting addition results.

var bag = inventory.GetItemCollection("Bag");
var equipment = inventory.GetItemCollection(ItemCollectionPurpose.Equipped)
    as ItemSlotCollection;

var added = inventory.AddItem("Health Potion", 5);
var potionDefinition = InventorySystemManager.GetItemDefinition("Health Potion");
var hasPotion = inventory.HasItem((1, potionDefinition));

var swordDefinition = InventorySystemManager.GetItemDefinition("Iron Sword");
var swordInfo = inventory.GetItemInfo(swordDefinition);
if (swordInfo.HasValue) {
    var removed = inventory.RemoveItem((1, swordInfo.Value));
}

inventory.AllItemInfos exposes the visible runtime cache, excluding collections whose Purpose is Loadout or Hide. Query the relevant collection directly when those Items are needed.

Require full acceptance before offering an exact-amount move:

var ironSword = InventorySystemManager.CreateItem("Iron Sword");
var requested = (ItemInfo)(1, ironSword);
var allowed = equipment.CanAddItem(requested);

if (allowed.HasValue && allowed.Value.Amount == requested.Amount) {
    var actuallyAdded = equipment.AddItem(requested);
}
Named event Target and payload
EventNames.c_ItemCollection_OnUpdate Collection; no payload.
EventNames.c_Inventory_OnUpdate Inventory; no payload after visible-cache update.
EventNames.c_Inventory_OnAdd_ItemInfo_ItemStack Inventory; original ItemInfo and resulting ItemStack.
EventNames.c_Inventory_OnRemove_ItemInfo Inventory; removed ItemInfo.
EventNames.c_Inventory_OnAddItemRejected_ItemInfoToAdd_ItemInfoAdded_ItemInfoRejected Inventory; requested, accepted and rejected values.
EventNames.c_Inventory_OnAddItemOverflow_ItemInfoToAdd_ItemInfoAdded_ItemInfoRejected Inventory; the same three overflow values.

Register and unregister matching signatures over the same lifecycle. Continue with Item Collections, Dynamic Inventory Size, Item Pickups and Events.