Context Menu - Item Side

Each UCrimsonInventoryItemInstance is automatically a context-action provider. Designers declare actions per item or per item-type tag; the function library merges both sources and the item instance implements ICrimsonContextActionProvider so client and server agree.

Full integration guide
See CrimsonCore -> Context Menu for the end-to-end setup (HUD layer, widget BPs, input bindings, player component). This page documents only the inventory-side authoring.

Two action sources, merged at runtime

SourceWhere it livesUse case
UCrimsonInventoryItemFragment_ContextActionsAttached to the item definition's Fragments array. Instanced TArray<UCrimsonContextAction*> authored inline.Per-item overrides: 'this health potion can also be Combined'.
UCrimsonInventoryItemTypeActionSetUPrimaryDataAsset referenced by UCrimsonInventorySettings::DefaultContextActionTypeSet.Per-type defaults: 'all weapons have Drop/Inspect', 'all consumables have Use/Drop'.

UCrimsonInventoryFunctionLibrary::GetContextActionsForItem(Item) merges both sources, dedupes by ActionTag (fragment wins), and sorts by SortPriority. The registry is always the project default - there is deliberately no per-call override, so the server's execution-time re-gather always matches the client's view. Deterministic for the same Item on client and server.

Authoring per-item actions

StepAction
1Open the UCrimsonInventoryItemDefinition asset
2Add UCrimsonInventoryItemFragment_ContextActions to its Fragments array
3Populate the fragment's Actions array - pick UCrimsonContextAction_GrantAbility for ability-triggered actions, or your own BP/C++ subclass
4On each action, fill ActionTag, DisplayName, Tooltip, Icon, SortPriority, and optionally SectionTag, bIsDefault, bIsDestructive, ConfirmationMode, CloseBehavior

Authoring per-type defaults

StepAction
1Content Browser -> Miscellaneous -> Data Asset -> CrimsonInventoryItemTypeActionSet
2Add rows mapping Item.Type.* tags to instanced action arrays
3Project Settings -> Crimson -> Crimson Inventory -> Default Context Action Type Set -> soft ref to the asset

ICrimsonContextActionProvider on UCrimsonInventoryItemInstance

The instance class already implements the interface and delegates straight to the function library, so server-side gather always matches the client's view:

cpp
void UCrimsonInventoryItemInstance::GatherContextActions_Implementation(
const FCrimsonContextActionContext& Context,
TArray<UCrimsonContextAction*>& OutActions)
{
OutActions = UCrimsonInventoryFunctionLibrary::GetContextActionsForItem(this);
}
Ownership validation
The instance also overrides ValidateContextActionRequest (server-side): the item must live in an inventory component owned by the requesting player (directly, or via Pawn/PlayerState owner chains). Requests for another player's items are rejected before any action runs.
Showing the menu
Call UCrimsonCoreContextMenuSubsystem::ShowContextMenuForItem(ItemInstance, Request) from your inventory slot widget (e.g. on OnContextMenuRequested). CrimsonInventory itself stays UI-free - all presentation routing lives in CrimsonCore.