Build a working coin counter, score display, and threshold event — step by step. GameCollectionManager tracks a number, fires events when it crosses thresholds, and can show its own UI with a single checkbox.
Three objects. One wire. That's the minimum viable collection system.
CollectionManager. Add the GameCollectionManager component. Set Label Prefix to something like Coins: . Enable Show UI — a text display will appear automatically at runtime, no Canvas needed.Collectible (or any tag you choose — it just needs to be consistent). Add an InputTriggerZone component to the player, set its Trigger Object Tag to match.CollectionManager, choose function GameCollectionManager → Increment(). The default increment is 1 — pass a specific int if you need a different value. Also wire On Enter → the collectible's SetActive(false) to hide it on collect.SetActive(false) on themselves, the prefab works fine.Thresholds let you react when the count crosses a number — in either direction. This is how you build win conditions, difficulty spikes, and bonus triggers.
Value to your target (e.g. 10 for collecting 10 coins).onCrossedUp event fires once when the value goes from below to at-or-above the threshold. Wire it to whatever should happen — GameStateManager.Victory() for a win, ActionAutoSpawner.StartSpawning() to trigger a wave, or ActionPlaySound.PlaySound() for a fanfare.onCrossedDown fires when the value drops back below the threshold. Useful for resources that can be spent — e.g. player uses 10 coins, drops below threshold, and a UI warning appears.onCrossedUp fires again. This is intentional — it lets thresholds work for both one-time win conditions and repeating bonus triggers. Set Max Value if you want to cap the score.Use one or the other — not both on the same manager at once.
| Field | What it does | Notes |
|---|---|---|
| Label Prefix | Text before the number (e.g. "Coins: ") | Include trailing space |
| Show UI | Creates a Canvas text display automatically | Disable if using GameUIManager |
| Text Position | Screen position of the text (top-left origin) | Use editor preview to position |
| Show Bar | Adds a progress bar below the text | Requires Max Value > 0 |
| Max Value | Cap on the value; bar fills to this | 0 = no cap, bar disabled |
| Thresholds | List of values that fire events on crossing | Add multiple for multi-stage goals |
| Persist Across Scenes | Carries the value across scene loads | Put in first scene only |