Skip to content

Project Setup

This guide explains how to integrate the Modular Inventory System into your Godot 4.6 project.

Enabling the Plugin

  1. Copy the addons/modular_inventory_system/ folder into your project's res://addons/ directory.
  2. Go to Project > Project Settings > Plugins.
  3. 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 Inventory resource at runtime if you haven't assigned one in the inspector.

  • EquipmentManager (v2.0):

  • Player: Reference to your player node.
  • Main Inventory: The InventoryComponent holding the player's items.
  • Hotbar: The ModularHotbar UI node to track the active item from.
  • Item Socket: (Optional) A Marker3D to attach 3D weapon models to.

Accessing the Inventory

You can access the underlying Inventory resource from any script via code:

var inv_comp = $InventoryComponent
var inventory = inv_comp.get_inventory()