Appearance
Containers, nesting, and filters
Configure the implementation
A URicContainerDefinition has:
ContainerFragment: the main fragment selecting class, tag, and layout.Fragments: additional filters and custom configuration.
Built-in main fragments are URicContainerFragmentJigsawFixedSize and URicContainerFragmentOneItem.
Create roots with Manager->AddContainerFromDefinition(), or several roots with AddContainersFromCollection(). The manager adds them to its inventory and maintains subobject replication.
Fixed jigsaw grid
URicContainerJigsawFixedSize supports multi-cell items, stacking, rotation, and custom masks.
FRicSize contains Columns and Rows. FRicCustomShape adds a packed Shape bit array. An enabled container bit means a usable cell; an enabled item bit means an occupied cell.
Slot indices are row-major: Index = Row * Columns + Column, starting at zero. For a 6-column grid, index 8 is column 2, row 1.
Construct a filled mask from dimensions when configuring native transient definitions:
cpp
FRicCustomShape OpenGrid(FRicSize(6, 4));Changing dimensions on an existing mask does not by itself reconstruct its bits. In asset authoring, inspect the enabled cells after resizing.
Use FindItemByIndex() to inspect a cell and GetItemOccupiedSlots() to inspect a footprint. A multi-cell item can appear in several slots. Use GetItems() for the container's item list rather than counting occupied cells as separate items.
Single-item container
URicContainerOneItem contains one item instance at slot 0. That item may represent a stack; "single item" describes the number of instance references.
This layout suits equipment and attachment sockets. It does not require a multi-cell footprint and normalizes placement rotation to D0. Filters decide which definitions or item tags are accepted.
Queries and hierarchy
cpp
#include "Components/RicContainerManagerComponent.h"
#include "Instances/RicContainerBase.h"
#include "Statics/RicGameplayTags.h"
URicContainerBase* Main =
Manager->FindContainerWithContainerTag(
RicGameplayTags::Container_Type_Main);
TArray<URicContainerBase*> All = Manager->GetContainersRecursive();
URicItemInstance* Item = Manager->FindItemByIdRecursive(ItemID);These statements assume valid Manager and a known ItemID.
Root-only and recursive variants are distinct. GetContainers() returns roots; GetContainersRecursive() returns the ordered tree. Container GetItems() returns immediate items; GetItemsRecursive() includes descendants.
Definition queries include FindItemByDefinitionRecursive() and FindItemsByDefinitionRecursive(). Count quantities with GetNum(); number of matching instances is not total stack quantity.
Automatic placement scope
Manager additions accept:
FindSpaceInContainers: tags selecting roots; empty selects all eligible roots.LookForPlaceInNestedItems: whether descendants can be used.ExcludeContainerTags: tags excluded from placement.
Selection uses tag hierarchy matching. Selecting a main root includes eligible child containers even if their own tags differ. Roots are attempted before deeper containers. Each call works on a stable ordered candidate list.
The swap buffer tag is automatically excluded from these manager additions.
Filters
URicContainerFragmentFilters supplies filter classes with optional ApplyToAllChildren. URicContainerFragmentDynamicFilter supplies a tag allow/reject rule. Dynamic matching tests whether the item matches any configured tag.
Built-in filters include:
URicFilter_LockedSlots: checks the container shape's usable bit.URicFilter_BanContainers: rejects items containing containers.URicFilter_DynamicFilter: runtime tag filter created from dynamic configuration.
For a multi-cell item, placement checks relevant occupied cells. Parent filters marked ApplyToAllChildren propagate into nested container placement.
Custom native filters override:
cpp
bool PassesFilter_Implementation(
URicItemInstance* Instance,
const URicContainerBase* Container,
int32 SlotIndex) const override;Filter classes normally run through shared class default objects. Keep per-item mutable state elsewhere.
Ownership and events
A container manager also has its own replicated tag-value statistics, independent of the items it manages. Read and modify them through the same stacked-tag API used by items. See Gameplay tags and statistics for the shared interface and OnGameplayTagChanged; OnItemGameplayTagChanged reports item changes separately.
Moving a containing item preserves its hierarchy. Placement rejects nesting into the same item or its descendants.
OnSlotsChanged supplies the container and affected slot indices. Manager events aggregate inventory changes. Use these notifications to refresh presentation rather than mutating the public grid storage directly.
Continue with Operations.