Item Data & Registry

Item Data Assets and Registry Subsystem

To interact with the MP_Inventory system, you don't use raw strings or heavy structs-you use lightweight Data Assets and a centralized Registry.

Item Definitions (UMP_ItemDefinition)

Items in your game are defined using Unreal Engine's Primary Data Assets.

To create a new item:

  1. Right-click in the Content Browser > Miscellaneous > Data Asset.
  2. Select UMP_ItemDefinition.
  3. Open the asset and configure:
    • ItemID: The unique FName (e.g., Weapon_AK47).
    • Max Stack Size: How many can fit in a single slot.
    • Weight: Used by the component's weight enforcement system.
    • UI Data: The Item Name, Description, and Icon for UMG.
    • Equipment Class: An optional reference to an Actor to spawn if the item is equipped (e.g., the physical gun mesh).

The Item Registry (UMP_ItemRegistry)

The Registry is a UGameInstanceSubsystem. It is instantiated automatically by the engine when the game starts.

1. Item Lookup

Instead of loading UI Icons and descriptions over the network, the FastArray only replicates the ItemID FName and Quantity. When the client UI receives an update, it queries the UMP_ItemRegistry using the ItemID to grab the Data Asset instantly, retrieving the Icon and Name locally.

2. Live Inventory Tracking

The Registry acts as a global phonebook for every active inventory in the world.

  • When a Chest spawns, its UMP_InventoryComponent registers its InventoryID with the Subsystem.
  • When a Player wants to loot that Chest, the Manager queries the Registry: "Give me the component for Chest_123."
  • The Registry returns the exact pointer in memory, allowing instant O(1) interactions across the entire map.