Game Manager

Inventory System

Track multiple item types in a single component. Each slot has its own name, icon, capacity, and events — call Increment("Keys") or Increment(0) from any trigger. Optional card UI generates automatically.

Multiple item types in one component
Per-slot full, empty, and change events
Icon card UI row (auto-generated)
Persists between scenes
Combination check — fire an event when multiple items are collected

Choosing the right manager

Inventory vs Collection

They look similar but serve different purposes.

GameInventoryManager — use when you have multiple item types
Keys, arrows, potions, gems — different things that need to be tracked separately. Each slot has its own name, icon, max capacity, and full/empty events. Increment("Keys") only adds to the Keys slot.
GameCollectionManager — use for a single score or currency
One number with threshold events — coins collected, score, lives. Simpler setup. Also used as the currency source for GameStoreManager. If you only need one number, use this.

Getting started

Minimal setup


Configuration

Slot fields and events

Slot FieldDefaultWhat it does
Item NameItemThe name used by IncrementByName() and DecrementByName(). Make it unique and descriptive ("Keys", "Arrows", "Potions").
IconnoneSprite shown in the UI card when Show UI is enabled.
Max Capacity10Increment stops at this value. onFull fires when the count reaches it.
Current Count0Starting count for this slot. Can be set above 0 to start with items.
onFullFires once when the count reaches Max Capacity. Wire to a "slot full" effect.
onEmptyFires once when the count drops to zero. Wire to a "out of ammo" or "no keys" response.
onChangedFires on every count change, passing the new count (int) as a parameter. Wire to a custom text display.
💡
Initial events fire on Start
On scene load, all slots fire onChanged with their starting count. This means any external text display wired to onChanged will show the correct value immediately without any extra setup.

Calling from UnityEvents

Public methods

All methods are callable from UnityEvents. Use the by-name versions — they're easier to read and still work correctly if you reorder slots later.

By index
Slot 0 = first slot in the list
Add itemIncrement(0, 1)
Remove itemDecrement(0, 1)
Use if availableUseItem(0, 1)
Read countGetCount(0)
By name
Matches Item Name in the slot config
Add itemIncrementByName("Keys")
Remove itemDecrementByName("Keys")
Read countGetCountByName("Keys")
Logs a warning in Console if no slot with that name exists.
🔑
UseItem — consume only if you have enough
UseItem(0, 1) calls Decrement only if currentCount >= amount. It does nothing if the slot is empty — perfect for door locks that should only open when the player actually has a key. Use it anywhere a "can I afford this?" check is needed.

Multi-item unlock

Combination Check

Fire an event the moment a player holds the right combination of items simultaneously — no extra components needed. Define the required counts in the Combination Check section and wire On Combination Met to any response.

Example — unlock the boss door
Requires 3 keys and 1 sword
Requirement 1Keys → 3
Requirement 2Sword → 1
On Combination MetDoor.SetActive(false)
Example — craft a potion
Consume ingredients, spawn result
Requirement 1Herbs → 2
Requirement 2Water → 1
On Combination MetActionSpawnObject.Spawn
🔁
Re-fires if broken and re-met
The event fires once each time the combination transitions from not met to met. If the player spends items (breaking the combination) and then re-collects enough, it fires again. Collecting extras beyond the requirement does not re-fire the event.

Inspector reference

Manager-level fields

FieldDefaultWhat it does
Persist Across ScenesfalseCarries slot counts when loading a new scene. Limited to the first 20 slots.
On RestartReset To DefaultWhen RestartScene() is called: Reset To Default clears counts; Keep Value preserves them.
Show UIfalseCreates a row of icon + count cards at runtime. One card per slot, laid out left to right.
Show CounttrueShows the numeric count inside each card. Uncheck for icon-only display (e.g. key slots where you just want to see the icon).
UI Position(60, -120)Top-left origin screen position for the first card. Cards extend to the right.
Card Size(70, 70)Width and height of each card in pixels (at 1920×1080).
Card Spacing8Gap in pixels between cards.
RequirementsemptyList of item + count pairs for the combination check. Each entry's Item Name must match a slot's Item Name exactly.
onCombinationMetFires when every requirement in the list is satisfied simultaneously. Only appears in the Inspector when at least one requirement is defined.