A highly extensible, multiplayer-ready, component-based inventory system built for Unreal Engine. It uses a Composition-over-Inheritance architecture, allowing you to build complex item behaviors using reusable modules instead of deep inheritance trees.
- 🧩 Component-Based Architecture (Modules): Attach functionality (e.g., Consumable, Equippable, Durability) to items dynamically using Item Modules. Avoid subclass bloat!
- 🌐 Multiplayer Ready: Built with replication in mind from the ground up. Optimized structuring using caching and
TArrayfor seamless network synchronization. - 🛡️ Type-Safety & Error Handling: All operations (
AddItem,TransferItem, etc.) return a detailedFInventoryOperationResultstruct for exact feedback. - 📦 Stack Management: Auto-stacking, merging, splitting, and limiting stack sizes native to the system.
- 📊 Data-Driven Design: Base item definitions are driven by structures (
FItemDefinition), making it incredibly easy to hook up to Data Tables. - 🔄 Flexible Slots: Support for distinct slot groups (e.g., Main Inventory, Hotbar, Equipment Slots) using custom
TypeIDs.
- Close your Unreal Engine project.
- Clone or copy the
InventorySystemfolder into thePlugins/folder of your project. If the folder doesn't exist, create it. - Open your project. When prompted, click Yes to rebuild the plugin modules.
- Go to Edit > Plugins, search for InventorySystem, and verify it is enabled.
- Open your Character blueprint.
- Add an InventoryComponent to the components list.
- In the component properties, define your
InventorySlotsGroup. You can set up how many slots the inventory has and assignTypeIDs(e.g., 0 for Main Bag, 1 for Hotbar).
- Create a Blueprint inheriting from
UItemBase(e.g.,BP_BaseItem). - Inside its default properties, setup the Item Definition (Name, Icon, Description).
- Under Item Modules, add any behaviors you need (e.g.,
BP_ItemModule_Consumable).
You can add items through C++ or Blueprint:
// Create an instance of the item
UItemBase* NewItem = InventoryComp->CreateItemInstance(ItemClassTemplate);
// Add to inventory (Pass -1 to let the system auto-assign based on type)
FInventoryOperationResult Result = InventoryComp->AddItem(NewItem, -1);
if (Result.bSuccess)
{
UE_LOG(LogTemp, Log, TEXT("Item added successfully!"));
}
else
{
UE_LOG(LogTemp, Warning, TEXT("Failed: %s"), *Result.Message);
}Transfer items between different slots or even entirely different inventories.
// Transfers item from Slot 0 to Slot 5
InventoryComp->TransferItem(SourceTypeID, 0, DestTypeID, 5);
// Split a stack in half
UItemBase* SplitStack = MyItem->SplitStack(MyItem->GetCurrentStackSize() / 2);The main actor component that lives on your Player, Chest, or Container. It manages FInventorySlotsGroup and fires delegates (OnItemAdded, OnItemRemoved, etc.) whenever the inventory changes.
The core item object. It mostly acts as a container for its Data and its Modules. You rarely need to inherit from this.
The secret sauce. You inherit from this to create specific logic.
Example: UWearableModule, UConsumableModule, UQuestItemModule
By combining modules, you can create a sword that is both equippable and has durability, simply by adding both modules to the ItemBase.
Inventories can have modules too! For instance, an AutoSortModule or a WeightLimitModule could be attached to the InventoryComponent.
This plugin supports replication out-of-the-box. Items and their inner modules utilize ReplicateSubobjects. Fast and reliable. Just ensure the Actor that owns the InventoryComponent is set to Replicate.
This project is licensed under the MIT License - see the LICENSE file for details.