Complete inventory system with slot-based storage, item stacking, and recipe-based crafting.
Complete inventory system with slot-based storage, item stacking, equipment slots, and recipe-based crafting using ScriptableObjects.
┌─────────────────────────────────────────────────────────────┐
│ ItemDataSO │
│ (ScriptableObject Asset) │
├─────────────────────────────────────────────────────────────┤
│ ID, Name, Description, Icon, Rarity │
│ Stacking: IsStackable, MaxStackSize │
│ Value: BuyPrice, SellPrice │
│ Equipment: EquipSlot, Stats │
└─────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────┐
│ InventorySystem │
├─────────────────────────────────────────────────────────────┤
│ InventorySlot[] (Item + Count) │
│ AddItem, RemoveItem, HasItem, GetItemCount │
│ Events: OnSlotChanged, OnInventoryChanged │
└─────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────┐
│ CraftingSystem │
├─────────────────────────────────────────────────────────────┤
│ CraftingRecipeSO[] (Ingredients → Result) │
│ CanCraft, TryCraft, GetCraftableRecipes │
└─────────────────────────────────────────────────────────────┘
| Component | Purpose |
|---|---|
ItemDataSO | Item definition (stats, rarity, etc.) |
InventorySystem | Slot-based item storage |
InventorySlot | Single slot (item + count) |
CraftingSystem | Recipe-based crafting |
CraftingRecipeSO | Recipe definition |
| Rarity | Color | Drop Rate |
|---|---|---|
| Common | Gray/White | ~60% |
| Uncommon | Green | ~25% |
| Rare | Blue | ~10% |
| Epic | Purple | ~4% |
| Legendary | Orange | ~1% |
| Mythic | Red | ~0.1% |
User: "Player picks up a potion."
Agent:
int overflow = inventory.AddItem(healthPotionSO, 1);
if (overflow > 0)
Debug.Log("Inventory full!");
User: "Can player craft an Iron Sword?"
Agent:
if (craftingSystem.CanCraft(ironSwordRecipe))
ShowCraftButton();
else
ShowMissingIngredients();
User: "Equip armor if slot is empty."
Agent:
if (item.IsEquippable && item.EquipSlot == EquipmentSlot.Chest)
equipmentSystem.TryEquip(item);
@loot-rng-management - Loot tables and drops@save-load-serialization - Persisting inventory@scriptableobject-architecture - SO patternstemplates/ItemDataSO.cs.txt - Item definitiontemplates/InventorySystem.cs.txt - Storage controllertemplates/CraftingSystem.cs.txt - Crafting logic