Null Bolt
Studio
reference

API reference

The public surface, condensed. Everything is in the flat InventorySystem namespace; all types carry full XML documentation in-source, so IntelliSense has the details.

InventoryController (grid)

MemberTypeDescription
Initialize()boolBuilds grid, placer, and save system; runs automatically in Start. Idempotent.
AddItem(data, position?, rotated?)virtual boolPlace at a cell, or auto-place when position is null (retries rotated for rotatable items).
RemoveItem(id) / MoveItem(id, pos, rotated?) / RotateItem(id)virtual boolMutations by instance ID.
GetItemAt(pos)ItemInstanceOccupant of a cell, or null.
CanPlaceItem(data, pos, rotated?) / CanPlaceItemIgnoring(…, ignoreID)boolPlacement validation; the Ignoring variant supports move-in-place checks.
FindFirstAvailablePosition(data, rotated?)Vector2IntFirst fitting cell, or (-1,-1).
SplitStack(id, amount, destination)boolSplits a stack onto a destination cell.
WouldMergeAt(source, dest) / TryPlaceDraggedItem(source, dest)boolThe drag-and-drop pipeline: merge prediction and verified placement.
TransferItemTo(target, item, preferredDest)boolCross-grid move to a preferred cell, with merge support and rollback.
OrganizeTopLeft/TopRight/BottomLeft/BottomRight(allowRotate?)boolAuto-pack the grid into a corner.
ResizeGrid(w, h)boolRebuilds the grid — destructive to current placements.
SaveInventory(file?) / LoadInventory(file?)boolJSON persistence (default file per inventory type).
CanAddItem / CanRemoveItem / CanPerformActionvirtual boolPermission gates — override for game rules; defaults allow everything.
OnItemAdded / OnItemRemovedevent Action<ItemInstance>Item entered/left this inventory.
OnInventoryChangedevent ActionAny state change.
Grid / Placer / GridWidth / GridHeight / InventoryType / InventoryIdpropsState access. Plus enums InventoryType { Player, Shop, Stash } and InventoryAction { AddItem, RemoveItem, MoveItem, RotateItem }.

SlotInventoryController & HotbarController

MemberTypeDescription
AddItem(data) / AddItems(data, count) / AddItemAt(data, slot, count?)boolSlot placement; AddItems is all-or-nothing with rollback.
MoveItem(id, newSlot)boolMove to empty, merge into same-type stack, or swap.
GetItemAt(slot) / FindItemSlot(id) / FindFirstFreeSlot()queryLookups by index / instance ID.
OnItemMovedevent Action<ItemInstance,int,int>Slot-only extra event: (item, oldIndex, newIndex).
ItemDataResolverstatic Func<int,ItemData>Override save-load item lookup (Addressables, custom catalogs).
HotbarController.OnSlotActivatedevent Action<int,ItemInstance>Digit key or click activated a slot; item is null for empty slots.
HotbarController.ActivateSlot(i) / BaseSlot / ListenForNumberKeysmembersManual activation, key offset, and built-in polling switch.

EquipmentController & EquipmentSlot

MemberTypeDescription
Equip(data) / EquipAt(data, slot) / Unequip(slot)boolTyped placement into paper-doll slots.
FindAcceptingSlot(data) / FindAcceptingSlotIndex(data)queryFirst empty slot whose accepted types match the item.
OnItemEquipped / OnItemUnequippedevent Action<ItemInstance, EquipmentSlotType>Loadout changes, with the resolved slot type — hang stat recalculation here.
EquipmentSlot.CanAccept(data)boolTrue when empty and the item’s EquipSlot is in acceptedTypes.
EquipmentSlot.AcceptedTypes / SlotLabel / CurrentItem / IsEmptypropsSlot configuration and state.

Data types

MemberTypeDescription
ItemDataScriptableObjectDefinition: ItemName, Description, Icon, ItemID, Width/Height, CanRotate, Stackable/MaxStackSize, Category, Rarity, IsEquippable/EquipSlot. Plus GetShape(), CanStackWith(), ValidateConfiguration(), BackgroundColor/AccentColor.
ItemInstanceclassRuntime state: Position, StackCount, IsRotated, Condition (0–1), CustomName, CurrentWidth/Height. Methods: Rotate(), AddToStack(), RemoveFromStack(), SetCondition(), SetCustomName(), GetOccupiedPositions(). Event: OnInstanceChanged.
ItemCategoryenumWeapon, Armor, Consumable, Tool, Misc, QuestItem.
ItemRarityenumCommon, Rare, Epic, Legendary, Unique.
EquipmentSlotTypeenumNone, Helm, Chest, Legs, Boots, Gloves, Shoulders, Cloak, MainHand, OffHand, Ring1, Ring2, Amulet, Belt, Trinket (stable ints 0–14).
RarityPaletteSOScriptableObjectRarity→color mapping. Statics: Current (assignable), Active (Current ?? defaults), DefaultColorFor(rarity). Pair with RarityPaletteApplier for no-code activation.
GridData / GridSlotclassPure grid occupancy model — dimensions, per-cell occupancy, no UI. Exposed via InventoryController.Grid.

Transfers & economy

MemberTypeDescription
InventoryTransfer.TransferItem(source, target, id | item)static boolOverloads for grid pairs and any IInventory pair; auto-placement with rollback on failure.
OnItemTransferred / OnTransferFailedstatic eventsGrid-overload family: (source, target, newInstanceID, fromPos, toPos) / (…, reason). Note the new instance ID.
OnAnyItemTransferred / OnAnyTransferFailedstatic eventsIInventory-overload family: (source, target, item) / (source, target, id, reason).
IEconomyinterfaceGetBuyPrice, GetSellPrice, CanPlayerBuy, CanShopBuy, ApplyPlayerBought, ApplyPlayerSold.
EconomyProvider.Currentstatic IEconomyThe active economy; null means all trades are free.
IInventoryinterfaceUnified container contract implemented by all four controllers: Items, CanAccept, AddItem(data, count), RemoveItem(instance).

Persistence & UI singletons

MemberTypeDescription
SaveSystemclassSaveInventory/LoadInventory, GetSaveFiles, SaveFileExists, GetSaveFileInfo, CreateBackup, DeleteSave. Atomic writes with .bak recovery; files under persistentDataPath/InventorySaves/{Type}/.
ItemDataCachestatic classSession cache for ID→ItemData resolution (Resources scan). Clear() after creating items at runtime.
ItemTooltipsingletonSelf-spawning hover tooltip. Statics: ShowDelayed(item, owner), HideFor(owner), HideImmediate(); content builders BuildInfoLine/BuildStatsLine/BuildEquipLine are reusable in your own UI.
TooltipHovercomponentAuto-attached hover trigger; SetResolver(() => item) if you build custom item visuals.
StackSplitDialogsingletonSelf-spawning split dialog: ShowDialog(item, onConfirmed, onCancelled?) / HideDialog().
ItemValidatorstatic classPure placement/collision math behind the controller — useful for custom previews. Throws on null args.
InventoryAPIstatic classGlobal convenience over the first scene controller: AddItem, RemoveItem, SplitStack, Save, Load, ClearCache.
// note
UI binders (GridUI, SlotInventoryUI, EquipmentPanelUI) and their item visuals are also public and virtual-friendly, but most projects only touch their inspector fields — slot size, columns, colors, icon fill ratio.