Appearance
Replication and client prediction
Components on the player inventory owner
Use the same owning actor for:
URicContainerManagerComponent: authoritative inventory tree.URicItemOperationsRPCsComponent: reliable server request gateway.URicClientPredictedInventoryComponent: local inventory model and predicted operations.
The actor must replicate and have the player's owning connection for client-to-server RPCs. Choose an actor whose lifetime fits your game: inventory attached to a respawned pawn needs explicit transfer or restoration if it should survive respawn.
For the supplied quick-slot UI, also add URicQuickSlotsComponent and URicClientPredictedQuickSlotsComponent to that owner. The manager, RPC component, and authoritative quick-slot component enable replication by default. Both prediction components are local and disable their own replication by default.
Initialize containers on authority. The manager replicates container references and inventory UObjects. Item quantities and statistics use replicated tag-stack state; layouts use their corresponding replicated storage.
Subobject replication
The manager supports two subobject-replication paths:
- Registered list, enabled by default with
bReplicateUsingRegisteredSubObjectList = true: the manager maintains registered containers and items throughAddReplicatedSubObject()andRemoveReplicatedSubObject(). Enable the registered-list flag on the owning actor too, as well as actor and component replication. - Legacy
ReplicateSubobjects(): with the registered-list setting disabled on the manager and owner, the manager explicitly replicates roots, items, and nested containers through the actor channel. A set prevents the same UObject from being replicated repeatedly during one traversal. Use this with the existing replication system.
Iris requires the registered list. The core module calls SetupIrisSupport(Target, bAddAsPublicDependency: true), and URicItemInstance and URicContainerBase implement RegisterReplicationFragments() under UE_WITH_IRIS. In ReadyForReplication(), the manager checks its net driver and forces its registered-list flag on when Iris is active. The owning actor still needs the registered list enabled. The module's build support does not select Iris as the project's active replication system.
See Multiplayer and prediction for Blueprint settings and links to Epic's engine configuration documentation.
Use normal manager/container operations to maintain registration across creation, transfer, removal, and load. Writing directly into slot arrays or owner fields can bypass required lifecycle work.
Build UI from the local model
cpp
#include "Components/RicClientPredictedInventoryComponent.h"
#include "Instances/RicContainerBase.h"
URicClientPredictedInventoryComponent* Prediction =
URicClientPredictedInventoryComponent::Get(InventoryOwner);
if (Prediction)
{
TArray<URicContainerBase*> VisibleContainers =
Prediction->GetContainerCopies();
}On an authoritative owner, the component's facade can return authoritative objects. On a remote client, it exposes local copies. Use the facade consistently and avoid manually cloning replicated inventory for the UI.
GetContainerCopies() includes the owned tree in depth order. GetAllContainerCopies() includes owned containers followed by observed containers.
Submit a predicted operation
cpp
URicItemInstance* ItemCopy = Prediction->FindItemCopyByID(ItemID);
URicContainerBase* TargetCopy =
Prediction->FindContainerCopyByID(TargetContainerID);
if (ItemCopy && TargetCopy)
{
Prediction->MoveItem(ItemCopy, TargetCopy, TargetSlot);
}The predicted path resolves references, mutates the local model, and dispatches server work. Replicated source changes reconcile the visible model.
Local true does not constitute a server acknowledgement. Use replicated state for authoritative rewards, purchases, and other gameplay outcomes.
Observe a chest or another inventory
The external actor needs its own manager and replicated inventory. Once your game grants access:
cpp
Prediction->SetObservedContainerManager(ChestManager);
TArray<URicContainerBase*> ChestCopies =
Prediction->GetObservedContainersCopy();On close:
cpp
Prediction->SetObservedContainerManager(nullptr);The chest must be replicated and relevant to the client. Observation selects client-visible data; it does not grant server authorization or create an owning connection to the chest. Requests still travel through the player's gateway.
Use IsObservedItem() and IsObservedContainer() when UI behavior depends on which inventory contains an object.
Resolve source and copy references
Useful mappings:
FindSourceItemByID()andFindItemCopyByID().FindSourceContainerByID()andFindContainerCopyByID().FindSourceContainer(ContainerCopy).- Definition queries with optional observed-inventory search.
Store GUIDs in selection and drag state. Re-resolve after synchronization or cross-manager movement. An old UObject can cease to be the current representation even when the logical item still exists.
Refresh notifications
OnSync reports a model synchronization. OnSyncContainer reports the GUID and current container. SubscribeToContainer() supports a per-container FOnContainerChanged delegate.
cpp
FOnContainerChanged Callback;
Callback.BindDynamic(this, &UYourInventoryWidget::HandleContainerChanged);
Prediction->SubscribeToContainer(ContainerID, Callback);The matching handler is:
cpp
UFUNCTION()
void HandleContainerChanged(const URicContainerBase* Container);Replace the example class with your own class. Keep the delegate so it can be passed to UnsubscribeFromContainer() with the same ID. Avoid ClearContainerDelegates() for closing one widget: it clears all consumers' subscriptions.
Some synchronization and manager notifications are deferred or debounced. Prediction's broadcast interval defaults to 0.05 seconds. Treat callbacks as an instruction to read current state, not as a synchronous transaction log.
Sync() and SyncContainerByID() explicitly refresh local state from the currently available source. They do not force the server to send an immediate new replication update.
Server gameplay permissions
The RPC gateway supplies inventory mechanics and structural checks. Its methods do not form a complete game permission system: several accept definition, quantity, statistic, action, or external-container references directly.
For multiplayer gameplay, authoritative code must decide whether a player may create items, alter a statistic, operate on an external inventory, or execute an action. Validate allowed scope and action semantics in your game's request path. A distance check in a local interaction strategy cannot authorize a server transfer.