Project Setup¶
This guide explains how to integrate the Modular Inventory System into your Godot 4.6 project.
Enabling the Plugin¶
- Copy the
addons/modular_inventory_system/folder into your project'sres://addons/directory. - Go to Project > Project Settings > Plugins.
- Check the Enable box next to Modular Inventory.
Autoloads¶
When you enable the plugin, InventoryPlugin.gd automatically registers global nodes that are always available (Autoloads). You do not need to add them manually:
| Autoload | Description |
|---|---|
DragDropSystem |
Handles global mouse input for dragging items, calculating drop targets, and dropping items into the 3D world. |
InputMode |
Manages mouse capture states (MOUSE_MODE_CAPTURED vs VISIBLE) so your player controller and UI don't fight for mouse control. |
UICoordinator |
Handles the positioning of multiple inventory panels (used automatically by UIStateManager). |
UIStateManager |
(New in v2.0) Manages a stack of UI panels, handles background overlays, game pausing, and quick-move targeting. |
Core Nodes¶
To give a Node (like your Player or a Chest) an inventory, you must attach the InventoryComponent node to it.
To handle item usage (attacks, consumables) automatically, add an EquipmentManager node to your Player.
- InventoryComponent:
- Capacity: Defines how many slots the inventory has.
- Slot Definitions: Allows you to assign specific
SlotRules to specific slots (e.g., slot 0 is for weapons only). -
Create if Missing: If enabled, it will automatically generate a blank
Inventoryresource at runtime if you haven't assigned one in the inspector. -
EquipmentManager (v2.0):
- Player: Reference to your player node.
- Main Inventory: The
InventoryComponentholding the player's items. - Hotbar: The
ModularHotbarUI node to track the active item from. - Item Socket: (Optional) A
Marker3Dto attach 3D weapon models to.