Adding Custom Item Fields
Overview
You may want to add custom properties to items beyond what UMI provides.Method 1: Use Gameplay Tags
The simplest approach - use gameplay tags for categorization: In ItemDataAsset:Method 2: Use Stat Modifiers
Store custom data as stats:Method 3: Extend FItemInstance
For complex custom data, extend the struct: C++:Method 4: Data Asset Extension
Create child class of ItemDataAsset:Creating New Item Types
Example: Spell Scrolls
1. Create Data Asset:Example: Seeds (Plantable Items)
Overriding Stacking Logic
Custom Stacking Policy
1. Add to Enum (in StackingUtils.h):Adding Custom Containers
Container Types
1. Simple Storage Container: Already provided viaInventoryComponent on actors.
2. Filtered Container (e.g., Weapon Rack):
Custom Abilities
Item Usage Abilities
1. Create Gameplay Ability:Weapon Abilities
Custom UI
Inventory Widget
Create your own inventory UI by reading fromInventoryComponent:
Blueprint Widget:
Equipment Widget
Performance Optimizations
Object Pooling for World Items
Batch Item Operations
Async Item Loading
Integration Examples
Disclaimer:
The examples below are not built-in features of UMI.
They demonstrate how you might integrate UMI with other systems such as quests, achievements, trading, or custom gameplay logic.
These snippets are provided as guidance and should be adapted to your project’s architecture.
Quest System Integration
Achievement System
Trading System
Best Practices for Extensions
- Use interfaces: Keep extensions modular
- Leverage gameplay tags: Flexible categorization
- Extend via inheritance: Don’t modify core classes
- Document custom systems: Help future developers
- Test thoroughly: Especially save/load functionality
- Maintain compatibility: Consider UMI updates
- Use events: React to system changes
- Validate inputs: Prevent exploits
- Optimize early: Profile custom code
- Version your extensions: Track changes