Skip to main content

Your First Inventory

This minimal test separates item registration from UI setup.

  1. Add InventoryComponent to your player Pawn or Character. Configure InventoryIdentityTag as Cube_Inventory.Target.Character.Inventory, CapacityType as SlotBased and MaxInventorySlots as 10.
  2. Create an item Data Asset of class PDA_InventoryMaster. Set ItemID to Apple, ItemType to Food, bCanStack to true, MaxStackSize to 10 and Weight to 0.2.
  3. Create PDA_ItemDatabase, set InventoryKey to Food and TargetInventoryTag to the same component tag. Add the Apple master to Entrys.
  4. Add that database to DatabaseArray in Project Settings → Cube Game Systems → Inventory SubSystem.
  5. Start PIE. Obtain the Game Instance's InventorySubSystem. Wait until GetItemByID(Apple) and GetDatabaseByItemID(Apple) return valid objects. The subsystem can exist while database loading is still in progress.
  6. On authority, call AddAmount with your Pawn, Apple and amount 3. Check bSuccess and OutAddedAmount.
  7. Resolve the component with GetInventoryCompByTag, then read GetInventory. Expect an entry with a valid SlotID, ItemID = Apple and StackSize = 3.
  8. Call RemoveAmount for 1 and verify the remaining quantity is 2.

For UI, create and assign slot data, configure PayloadClass, InventoryEntryClass and a ToolTipMap entry for Food, then create an Inventory Frame with an owning player. For clients, submit the operation through the Server RPC integration.

Avoid arbitrary delays as a loading contract. Use a bounded project readiness check and show a loading/error state if registration fails. See Subsystem Lifecycle.