Game Manager

Game Store Manager

Add a fully self-contained in-game shop to your project — scrollable item list, buy buttons, balance display, and sound effects. Wire purchase events to any game effect. No UI setup required.

Currency deducted automatically
Per-item purchase events
Permanent upgrades persist between levels
Walk-up shopkeeper support

Getting started

Minimal setup

Three steps and the store is playable. Everything else — UI, audio, persistence — is optional.

🎯
Wire On Purchased to game effects, not UI
The store handles its own sound effects, button states, and balance display. Wire On Purchased to things that affect gameplay: PlayerController.EnableDoubleJump(), GameHealthManager.Heal(25), Spawner.SetActive(true). This event also re-fires when a persistent item is restored on scene load — so game state is always correct.

Configuration

Store Items

Each item in the list is independently configured. Give it a name, a price, and wire On Purchased to whatever should happen when the player buys it.

FieldDefaultWhat it does
Item NameItemDisplay name shown in the store row.
IconnoneOptional sprite shown on the left of the row.
Price10Cost deducted from the Currency Source on each purchase.
Max Purchases00 = unlimited (consumable). 1 = one-time unlock. 3 = up to three times. The Buy button greys out when the limit is reached.
Persist PurchasetrueRemember the purchase count across scene loads. Leave on for permanent unlocks and upgrades. Turn off for consumables like health packs — they don't need to be remembered.
On PurchasedFires on each successful purchase. Wire to gameplay effects only — sounds and UI are automatic.
On Cannot AffordFires when the player tries to buy but lacks the funds. Wire to a shake, flash, or audio cue if desired.
💡
Stackable upgrades fire once per purchase on restore
If a player buys a speed upgrade twice (Max Purchases: 3, Persist Purchase: on), On Purchased fires twice when the scene reloads — applying both upgrades correctly. You don't need to track anything manually.

How the store opens

Open Mode

Choose between a global key shortcut or event-driven opening for a walk-up shopkeeper in game space.

Key
Global keyboard shortcut
Press a key (default: B) from anywhere to toggle the store open and closed. Good for inventory-style shops accessible at any time.

Change the key in the Open / Close Key field below the mode selector.
Event Only
Walk-up shopkeeper
The store only opens when OpenStore() is called from a UnityEvent. Place the shopkeeper anywhere in the world — the player must walk up to buy.
  • 1
    Set Open Mode → Event Only
  • 2
    Add InputTriggerZone to a collider near the NPC
  • 3
    Wire On EnterGameStoreManager.OpenStore()
  • 4
    Wire On ExitGameStoreManager.CloseStore() (optional — the ✕ button also closes)
🕹️
Character controllers are paused automatically
Assign the player's controller in the Character Controller section. CharacterControllerFP has its look input disabled and cursor released. CharacterControllerCC has movement disabled. Both are restored when the store closes.

Multi-scene games

Persistence across scene loads

Items with Persist Purchase enabled remember how many times they've been bought — even when the scene changes. The store restores game state automatically on load.

Persist Purchase ON
Double Jump Unlock
Max Purchases: 1. Bought in Level 1 → still unlocked in Level 2. On Purchased re-fires on load to re-enable the ability.
Persist Purchase ON
Speed Upgrade
Max Purchases: 3. Bought twice → On Purchased fires twice on next scene load, applying both upgrades.
Persist Purchase OFF
Health Pack
Max Purchases: 0 (unlimited). Nothing to remember — each purchase is a one-time heal. Persisting a consumable count does nothing useful.

On Restart

When a scene is loaded via GameSceneManager.RestartScene() — for example after the player dies — the On Restart setting controls what happens to purchase history.

On RestartBehavior
Keep Value default Purchase history survives death. The player keeps the double jump they worked to unlock — recommended for permanent upgrades.
Reset To Default All purchase counts clear on restart. Use for roguelike-style runs where you lose everything on death.
🔁
RestartScene vs LoadScene
Use GameSceneManager.RestartScene("Level1") for death/failure restarts — this is what triggers the On Restart behavior. Use LoadScene("Level2") for progression — purchase history always carries forward regardless of On Restart setting.

Common patterns

Recipes

Copy these configurations directly into the Store Items list.

Permanent unlock
One-time ability or area unlock
Max Purchases1
Persist Purchasetrue
On RestartKeep Value
On Purchased →Enable ability, open door, activate spawner
Consumable
Health pack, ammo, one-use boost
Max Purchases0 (unlimited)
Persist Purchasefalse
On Purchased →GameHealthManager.Heal(25)
Stackable upgrade
Buy multiple tiers of the same boost
Max Purchases3
Persist Purchasetrue
On Purchased →PlayerController.IncreaseSpeed(5) — fires once per tier on restore
Walk-up shopkeeper
Store in world space, open on approach
Open ModeEvent Only
InputTriggerZoneOn Enter → OpenStore()
InputTriggerZoneOn Exit → CloseStore()
CC ControllerAssign player to freeze movement

Inspector reference

All fields and events

The defaults work for most setups. Only the Currency Source and Store Items require configuration.

FieldDefaultWhat it does
Currency SourceRequired. The GameCollectionManager whose value is spent on purchases.
Open ModeKeyKey: toggle with a keypress. Event Only: open/close via UnityEvents.
Open / Close KeyBKey used when Open Mode is Key. Hidden when Event Only is selected.
FP ControllernoneOptional. Disables look input and releases cursor while the store is open.
CC ControllernoneOptional. Disables movement while the store is open.
One Per VisitfalseIf on, each item can only be bought once per store opening, regardless of Max Purchases.
On RestartKeep ValueWhat happens to persistent purchase counts when RestartScene() is called.
Audio ManagernoneOptional GameAudioManager for music switching when the store opens and closes.
Store MusicnoneMusic to play while the store is open. Requires Audio Manager.
Previous MusicnoneMusic to restore on close. Requires Audio Manager.
Purchase SoundnonePlays on each successful purchase via the assigned Audio Source.
Can't Afford SoundnonePlays when the player tries to buy but cannot afford the item.
Show UItrueCreates a self-contained store panel at runtime. Disable if you want to build your own UI and call PurchaseItem(index) manually.
Store TitleSTOREText shown at the top of the panel.
EventWhen it fires
onStoreOpenedStore panel becomes visible. Wire to a pause overlay, background dim, or audio trigger.
onStoreClosedStore panel is hidden. Wire to resume gameplay elements.
onAnyPurchaseFires whenever any item is successfully purchased. Wire to a shared feedback effect.