‹
Inventory Generator
Item.gd · Inventory.gd · InventoryUI.gd · SlotPanel.gd
GDScript 4.x
Item Resource
Item.gd
Inventory
Inventory.gd
UI
InventoryUI.gd
Slot Panel
SlotPanel.gd
Item Resource — Core Fields
These are the built-in fields every item has. All become @export vars in Item.gd so you can fill them in the Godot inspector per .tres file.
class name
id field name
name field name
texture field name
stack capacity field
space occupied field
default stack capacity
3D model field
PackedScene (optional)
3D model field name
Remove Mode
When a stack is dragged out of the inventory — remove the whole stack, or just deduct one item.
remove_mode field name
enum values
Custom Item Fields
Extra @export fields added to Item.gd — e.g. category, description, damage, weight.
+ Add Custom Field
Inventory Settings
autoload name (in Project Settings)
slot count
slots array name
Each slot is a Dictionary: { "item": Item, "quantity": int } or null if empty.
Signals
item_added signal
item_removed signal
inventory_full signal
slot_updated signal
InventoryUI — Export Vars
These become @export vars on the InventoryUI root node. Assign them in the Godot inspector — no hardcoded paths in code.
script class name
GridContainer export var name
Slot template PackedScene export var name
Texture NodePath export var name
Quantity Label NodePath export var name
Custom UI Field Bindings
Each binding is an @export NodePath on InventoryUI. Assign the label/node in inspector. The generator wires it to the matching item field.
export var name
item field it shows
+ Add UI Field Binding
SlotPanel — Drag & Drop
SlotPanel.gd is attached to each duplicated panel node. It handles all drag and drop logic using Godot 4's built-in system.
script class name
slot index var name
inventory UI parent var name
drag preview scene export var
Drop outside inventory area respects item's remove_mode — FULL_STACK removes all, ONE_BY_ONE deducts 1.
▶ Generate All 4 Scripts
Item.gd
save as Resource, make .tres
Copy
# tap Generate to produce code
Inventory.gd
add as Autoload singleton
Copy
# tap Generate to produce code
InventoryUI.gd
attach to inventory scene root
Copy
# tap Generate to produce code
SlotPanel.gd
attach to slot template scene root
Copy
# tap Generate to produce code