Skip to content

UMIPItemDefinition

Overview

UMIPItemDefinition is the authoring-time definition for a single item type in ModularInventoryPlus. It subclasses UDataAsset directly (not UMIPBaseDataAsset) and holds display data (name, description, icon, world mesh), classification tags (primary tag, quality, category, sub-tags), economy (SellValue), and an array of UMIPItemPiece instances that implement behavior (equipment, stackable, usable, etc.).

Native blueprint or C++ subclasses of UMIPItemDefinition populate RequiredItemPieces in their constructor to auto-create default UMIPStaticItemPiece subobjects (equipment definition, stackable, usable). GetPrimaryAssetId() builds a FPrimaryAssetId from ItemType (set per native class) and the asset name.

All paths below are relative to Plugins/ModularInventoryPlus/Source/ModularInventoryPlus/.


Key Classes & Files

Class File
UMIPItemDefinition Public/Inventory/Definitions/MIPItemDefinition.h
FMIPItemStaticMeshInfo Same header
IsDataValid / CheckForErrors Private/Inventory/Definitions/MIPItemDefinition.cpp

Properties

Identity and display

Property Type Description
ItemType FPrimaryAssetType Primary asset type for this definition (set in native parent class).
DisplayName FText Shown in UI.
Description FText Tooltip body.
SellValue int64 Base vendor sell value.
ItemPrimaryTag FGameplayTag Main classification (Inventory, Title, Knowledge, …).
Quality FGameplayTag Rarity tier (default common).
Category FGameplayTag Broad category (weapon, armour, junk, …).
ItemSubTags FGameplayTagContainer Extra filters / behavior tags.
ItemIcon UTexture2D* Grid / tooltip icon.
ItemStaticMeshInfo FMIPItemStaticMeshInfo World pickup mesh + transform.

Pieces

Property Type Description
Pieces TArray<UMIPItemPiece*> Instanced pieces (equipment, usable, …); populated at construction from RequiredItemPieces in subclasses.

RequiredItemPieces is protected — list of TSubclassOf<UMIPStaticItemPiece> used only in native subclasses to create default subobjects.


Runtime API

Function Role
FindPieceByClass Find first piece instance of a given class.
IsItemStackable True if a UItemPiece_StackableDefinition piece exists.
CheckIfContainAPieceClass Whether Pieces contains a subclass of the given piece class.
GetIdentifierString / GetPrimaryAssetId Asset identity for saves and UI.

Editor validation

IsDataValid (#if WITH_EDITOR) calls Super::IsDataValid, returns early if already invalid, then aggregates CheckForErrors() and adds each returned FText as Context.AddError, marking the asset invalid.

CheckForErrors

When Category matches Tag_InventoryCategory_Equipment exactly, every entry in RequiredItemPieces must have a matching piece instance already created on the asset (CheckIfContainAPieceClass). If a required class is missing, an error is added:

  • Format: {0} requires {1} where {0} is the primary asset type name and {1} is the required piece class name.

This catches item definitions that declare an equipment piece class in RequiredItemPieces but failed to instantiate it on the asset.


Integration

Topic Link
Item instances and pieces Item Pieces and Instance
Item piece overview UMIPItemPiece
Equipment piece asset UMIPEquipmentPieceAsset
Data assets index Data assets index