Appearance
Quick slots
References, not additional storage
A quick slot points to an existing inventory item. Assigning a shortcut does not remove that item from its container or create another copy.
URicQuickSlotsComponent maintains replicated assignments. URicClientPredictedQuickSlotsComponent maintains local GUID assignments and resolves them through inventory prediction.
Include:
cpp
#include "Components/RicQuickSlotsComponent.h"
#include "Components/RicClientPredictedQuickSlotsComponent.h"Configure before BeginPlay
Create the authoritative component with the inventory manager. Configure count before BeginPlay, for example in the actor constructor:
cpp
URicQuickSlotsComponent* QuickSlots =
CreateDefaultSubobject<URicQuickSlotsComponent>(TEXT("QuickSlots"));
QuickSlots->SetQuickSlotsCount(4);Indices are zero-based. Give the component a stable ID where required by your persistence setup. Configure FilterClasses to limit eligible items.
For predicted UI, also create URicClientPredictedQuickSlotsComponent on the actor containing inventory prediction and the RPC gateway.
Assign, read, clear
On authority:
cpp
const bool Assigned = QuickSlots->SetItemToQuickSlot(0, Item);
URicItemInstance* AssignedItem = QuickSlots->GetItemAtSlot(0);
QuickSlots->ClearQuickSlot(0);For the player's local model:
cpp
PredictedQuickSlots->SetItemToQuickSlot(0, ItemCopy);
URicItemInstance* AssignedCopy = PredictedQuickSlots->GetItemAtSlot(0);Use the return value for local failure handling. Assignment requires a valid index, eligible item, and allowed ownership. GetItemAtSlot() can return null.
Ownership tracking
Assignments observe the ownership chain, including containing items. Moving a backpack between inventories can therefore invalidate shortcuts to items inside it. Use OnQuickSlotChanged to refresh the relevant shortcut instead of retaining a raw item pointer indefinitely.
Predicted assignments use PredictedQuickSlotIDs; resolve current item copies when drawing or activating them. Sync() rebuilds predicted assignments from authoritative quick-slot state.
Activation belongs to gameplay
Your input binding reads the assigned item and decides what it means to activate it: equip, consume, select, or run a configured item action. Assigning a quick slot does not automatically create that behavior.
Saving
GetSaveData() returns slot count and a map from index to item GUID. Restore the inventory before calling LoadFromSaveData(), so assigned GUIDs can resolve. World-level inventory saves already include quick slots found on registered owners.
See Persistence.