Inventory Manager
UMP_InventoryManager router logic
While the Component stores items, the UMP_InventoryManager routes the actions. It is an Actor Component that should exclusively live on your PlayerController.
The Central RPC Hub
Unreal Engine's networking requires Client-to-Server RPCs to be called on an Actor that the client physically owns (like the PlayerController).
Because UMP_InventoryComponents can exist on unowned objects (like a random Chest in the woods), clients cannot call AddItem directly on the chest's component.
Instead, the workflow is:
- The UI tells the Manager to move an item into a Chest.
- The Manager executes a Server RPC (
Server_TransferItem). - The Server Manager looks up the Chest's component, validates permissions, and safely moves the item.
- If the action fails (e.g., Chest is full), the Manager fires a
Client_OnActionNotifywith a player-facing error (like"Inventory Full"or"Access Denied").
Multi-Inventory Operations
The Manager handles complex transactions that bridge two different components natively:
- SwapItemsBetweenInventories: Safely swaps an item in the player's backpack with an item in a chest, handling reverting if either side rejects the transaction.
- TransferItemBySlot / TransferItemByID: Moves a specific quantity of an item from one component to another without duplicating or losing data.
Proximity Loot Tracking (Nearby Loot)
A standout feature of the Manager is the Nearby Loot API.
- When a player walks near a dropped item in the world, the item registers itself with the Manager's
NearbyLootarray. - The Manager broadcasts
OnNearbyLootChanged. - The UI listens to this and dynamically updates the "Loot Area" panel.
- Because the Manager uses direct
AActor* GroundActorreferences instead of fragile array indices, players can spam-click to pick up 50 items simultaneously in O(1) time without index-shifting desyncs!