Appearance
Gameplay tags and statistics
Items (URicItemInstance) and container managers (URicContainerManagerComponent) both store runtime values as Gameplay Tag → nonnegative integer pairs. Each object owns an independent FRicGameplayTagStackContainer in its StackTags member. Use this for item condition, ammunition, or an inventory owner's health, stamina, and other counters.
Include Statics/RicGameplayTags.h to use the supplied RicGameplayTags native constants. You can also register project-specific tags. The Blueprint guide describes the same system through nodes and events.
Value rules
A value is an int32 count. A missing tag reads as 0; setting a tag to zero or a negative value removes its entry. The system does not store negative or fractional attributes. Register a valid Gameplay Tag before using it; mutation with an invalid tag logs a warning and does nothing.
Numeric lookup uses the exact tag. Reading a parent tag does not sum its children. Hierarchical category matching through FGameplayTagContainer is a separate operation.
Categories and numeric statistics share this storage. A category added by a Tags fragment has count 1; a statistic such as condition might have count 75. GetOwnedGameplayTags() returns the tags present in the storage, including both categories and statistics, without their counts.
Read and modify
Both the item and the manager expose:
GetStatTagStackCount(Tag): read the exact tag's count, or zero if absent.SetStatTagStack(Tag, Count): replace the value; a nonpositive count removes the tag.AddStatTagStack(Tag, Count): add a positive amount, creating the entry if needed. Nonpositive amounts do nothing.RemoveStatTagStack(Tag, Count): subtract a positive amount, removing the entry when the result reaches zero. Nonpositive amounts and missing tags do nothing.GetOwnedGameplayTags(OutTags): get the present tags without counts.GetOwnedStackGameplayTags(OutStacks): copy the object's tag-value storage into a snapshot.
cpp
#include "Components/RicContainerManagerComponent.h"
#include "Instances/RicItemInstance.h"
#include "Statics/RicGameplayTags.h"
// Authoritative gameplay code; Manager and Item are valid runtime objects.
Manager->SetStatTagStack(RicGameplayTags::Item_Stat_MaxHealth, 100);
Manager->SetStatTagStack(RicGameplayTags::Item_Stat_Health, 100);
Manager->RemoveStatTagStack(RicGameplayTags::Item_Stat_Health, 25);
// The manager's health is now 75.
Item->SetStatTagStack(RicGameplayTags::Item_Stat_Condition, 80);
Item->RemoveStatTagStack(RicGameplayTags::Item_Stat_Condition, 5);
// This item's condition is now 75, independently of the manager.The native health tags have an Item prefix but can also be used in a manager's storage. A tag's name does not restrict which of these objects can store it.
The storage does not associate a value with a maximum. Adding health can exceed MaxHealth, and setting MaxHealth does not change Health. Clamp values in your gameplay logic. Storing health or condition does not itself apply damage, healing, death, or durability effects.
Use the object's mutation methods rather than editing StackTags.Stacks directly. The methods keep lookup data, replication tracking, and change callbacks consistent. A snapshot returned by GetOwnedStackGameplayTags() is a copy; changing it does not change the source object.
Shared stacked-tag interface
Both objects implement IRicGameplayStackTagAssetInterface, declared in Interfaces/RicGameplayStackTagAssetInterface.h. It provides a common read contract:
cpp
virtual void GetOwnedStackGameplayTags(
FRicGameplayTagStackContainer& OutTags) const = 0;
virtual int32 GetStatTagStackCount(FGameplayTag Tag) const;Use the interface when a consumer should read a value from either an item or a manager:
cpp
#include "Interfaces/RicGameplayStackTagAssetInterface.h"
int32 ReadStat(const UObject* Source, FGameplayTag Tag)
{
if (!IsValid(Source) || !Tag.IsValid())
{
return 0;
}
const auto* Stats = Cast<IRicGameplayStackTagAssetInterface>(Source);
return Stats ? Stats->GetStatTagStackCount(Tag) : 0;
}Pass an item instance or manager component as Source. The default interface implementation obtains a stack snapshot and reads its count. The manager overrides the count accessor to read its own storage directly.
For native access to all pairs, call GetOwnedStackGameplayTags(Snapshot), then Snapshot.GetTagStackMap(). Snapshot.GetStackCount(Tag) and Snapshot.ContainsTag(Tag) provide exact-tag queries; Snapshot.ToTagContainer() drops the counts.
To implement this contract on another native UObject class, inherit from IRicGameplayStackTagAssetInterface and override GetOwnedStackGameplayTags() to supply that object's storage. You can also override GetStatTagStackCount() for direct lookup. The interface alone does not provide storage, replication, mutation methods, or notifications.
The reflected type is URicGameplayStackTagAssetInterface. It is Blueprint-visible, and Get Stat Tag Stack Count is callable from Blueprint, but CannotImplementInterfaceInBlueprint requires implementations to be written in C++. These are ordinary native virtual functions; call them through the interface pointer rather than an Execute_ wrapper. The complete-stack getter is exposed to Blueprint by the item and manager classes.
Both classes also implement Unreal's IGameplayTagAssetInterface for tag presence and category queries. Use the RIC stacked-tag interface when you need the numeric value. Mutation methods and change delegates belong to the concrete item and manager classes, not the shared interface.
Initial values
Configure item defaults on its definition:
- Stats (
URicItemFragmentSetStats):InitialItemStatsmaps tags to counts, applied throughAddStatTagStack()when the instance is initialized. - Tags (
URicItemFragmentGameplayTags):InitialItemTagsadds each tag with count1during initialization.
Both fragments add to the same storage. If the same tag appears in both, their counts add together. Keep category tags and numeric defaults distinct unless that addition is intentional. Changing a definition's defaults does not rewrite the values of existing instances.
When creating an item with FRicAddItemParams, its GameplayTags entries set per-instance values after definition initialization. The service tags for rotation, maximum stack size, and stack count are excluded from this override path; inventory creation handles them separately.
A manager has its own runtime storage rather than item-definition fragments. Set its initial values in your server-side owner initialization flow. When restoring a save, avoid overwriting the restored values with fresh defaults.
Change notifications
Bind to the appropriate dynamic multicast delegate:
Item->OnGameplayTagChanged: item instance, Gameplay Tag, old value, new value.Manager->OnGameplayTagChanged: manager, Gameplay Tag, old value, new value, for the manager's own stats.Manager->OnItemGameplayTagChanged: item instance, Gameplay Tag, old value, new value, for changes to items belonging to that manager.
Item and manager notifications are deferred until the next tick, for both local mutations and received replication. The value itself is updated by the mutation before the deferred delegate runs. Use the event's values when handling that notification; a fresh read may already include later changes. A Set call can notify even when old and new values are equal, so compare them if you need a transition.
For UI, subscribe to the runtime object, read its current values immediately to initialize the display, then refresh on relevant tag events. Read both current and maximum health when either changes. Unbind when changing the source or destroying the consumer, and resolve replacement item instances again by their ID.
The item notification forwarded to a manager uses the manager that owned the item when the change was made. A transfer before the deferred callback runs can change its current owner.
Replication and prediction
Both StackTags properties are replicated. Their shared storage uses Fast Array replication, with an array of tag-count entries and a lookup cache. Replicated additions, changes, and removals update the local cache and trigger the object's change callback. The manager component replicates by default; its actor must also replicate and be relevant to the receiving client. Item state travels with the manager's replicated inventory tree.
Direct Set/Add/Remove methods are local mutations, not server RPCs, and do not enforce authority themselves. Change authoritative gameplay values on the server. A client-only manager edit does not update the server; manager stats have no equivalent of the item prediction helpers.
For supported local item prediction, use SetItemStatTagStack, AddItemStatTagStack, or RemoveItemStatTagStack on URicClientPredictedInventoryComponent, with the appropriate item copy from the predicted inventory. These methods update the local item and send the corresponding request through the inventory RPC component. Keep authoritative gameplay validation on the server.
Replication synchronizes state; clients may receive a final value after several server changes. Do not rely on these notifications to deliver every damage or healing action as a separate network event.
Persistence and totals
Manager save data includes its own values in FRicContainerManagerSaveData::StatTags. Items store their values in FRicItemSaveData::TagStack, including items in nested containers. See Persistence.
RestoreStacks() restores storage without calling OnValueChanged. In particular, manager LoadFromSaveData() restores its own stats through this silent path. Refresh a server or standalone UI explicitly after loading; remote clients receive the restored state through replication. Item restoration can create new runtime objects, so rebind consumers to the restored items.
GetStatTagStackCount(Tag) always reads the target object's own value. GetTotalStat(Tag, bMultiplyByStackCount) has a different scope:
- On a manager, it sums the stat across its items, including nested contents, and excludes the manager's own value.
- On an item, it includes that item's own stat and the stats of items in its nested containers.
The native manager and item total methods default bMultiplyByStackCount to false. Enable it for per-unit values such as weight or price. A value of 10 on an item stack of 3 contributes 10 when disabled and 30 when enabled. Read an owner's health with Manager->GetStatTagStackCount(HealthTag).
Runtime statistics
The native constants correspond to:
Item_Stat_StackCount→Ric.Item.Stat.StackCount.Item_Stat_MaxStackSize→Ric.Item.Stat.MaxStackSize.Item_Stat_Rotation→Ric.Item.Stat.Rotation.Item_Stat_AmmoCount→Ric.Item.Stat.AmmoCount.Item_Stat_MaxAmmoCount→Ric.Item.Stat.MaxAmmoCount.Item_Stat_Condition→Ric.Item.Stat.Condition.Item_Stat_Energy→Ric.Item.Stat.Energy.Item_Stat_Weight→Ric.Item.Stat.Weight.Item_Stat_Health→Ric.Item.Stat.Health.Item_Stat_MaxHealth→Ric.Item.Stat.MaxHealth.Item_Stat_Price→Ric.Item.Stat.Price.
Stack count, rotation, and magazine counts are consumed by inventory mechanics. Condition, weight, health, price, and energy provide values your game can interpret; they do not automatically implement capacity or gameplay effects.
Rotation counts represent enum values 0–3. Zero is the unrotated default, including when the tag is absent.
Container categories
Built-in roots include:
Ric.Container.Type.Main.Ric.Container.Type.Pockets, withPockets_1throughPockets_4children.Ric.Container.Type.Chest.Ric.Container.Type.World.Ric.Container.Type.Carrier.Ric.Container.Type.Swap.
The swap tag identifies temporary swap storage and is excluded from ordinary manager additions.
A tag is not a unique identifier. Multiple containers can have the same category; use GUIDs for a particular runtime container.
Item categories
Native categories include Ric.Item.Ammo and Ric.Item.Ammo.556x45; attachment categories such as Ric.Attachment.Optic, Muzzle, Foregrip, TacticalDevice, and Magazine; equipment categories such as Ric.Equipment.Backpack, PrimaryWeapon, and BodyArmor; and Ric.WeaponClass categories.
Use tags to classify items and drive filters. Applying a weapon/equipment tag does not automatically equip an actor or grant gameplay abilities.
Interaction state
The interaction module declares tags in RicInteractionTags.h. Hidden and Disabled state have distinct meanings: visibility controls discovery/presentation, while enabled state controls availability.
Use point methods to change these states so the runtime tag representation stays consistent.
Custom tags
Declare native tags in your game or register them in your project's tag settings. Add initial item categories through a Tags fragment and statistics through a Stats fragment.
Use exact tags for a specific category and hierarchical matching when parent categories should accept children. Manager placement's root selection uses hierarchical matching; a first-container lookup should not be assumed to have identical matching semantics.
RicGameplayTags::FindTagByString() supports lookup with optional partial matching. Prefer declared native constants in gameplay code where the intended tag is known.