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, inventory_plugin.gd automatically registers three 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 (e.g., placing the player inventory on the right and a chest inventory on the left).

InventoryComponent

To give a Node (like your Player or a Chest) an inventory, you must attach the InventoryComponent node to it.

  • 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.

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()