UGTK / Toolkit / Gameplay Systems / Achievement System Completed
Achievement System
Summary
Tracks counter and boolean achievements at runtime, persists them through the UGTK SaveSystem, and exposes view-models used to populate dashboard rows.
Content
Modules Dependencies
- UGTK.Data.DatabaseSystem —
SO_CounterAchievementDatabase/SO_BooleanAchievementDatabaseand theirS_*Definitionentries. - UGTK.Data.SaveSystem — persistence via
SaveSystemand theIAutoSaveObjectcontract. - UGTK.DesignPattern.Singleton —
Mn_AchievementManagerderives fromMn_Singleton<T>. - UGTK.UIModule.DashboardSystem — dashboard row holders used by the achievement UI.
Carried inside the prefabs. These modules are not referenced by the assembly definition - the components are simply already attached to the prefabs this module ships. Remove one of them from the project and the prefab keeps its layout and loses that behaviour, with nothing in the console to say so.
| Module | Component, and the prefab carrying it |
|---|---|
UIModule/TextUpdaterSystem |
Mn_TextUpdater (in BooleanButton), Mn_TextUpdater (in CounterButton) |
Only in the demo scene. The Debug scene of this module also uses GameplaySystems/AudioSystem, UIModule/LayoutAutoResize, UtilitySystems/PoolingSystem.
Nothing in the runtime code needs them: import this module on its own and it works, but
the demo scene opens with missing scripts where those components were.
Setup
Place a single Mn_AchievementManager in the scene and assign the counter and boolean achievement databases plus the save file name/directory in the Inspector. Add dashboard and button components where you want to display or trigger achievements.
How To Use
- Add
Mn_AchievementManagerto a scene GameObject and assignSO_CounterAchievementDatabaseandSO_BooleanAchievementDatabase. - Report progress from gameplay code:
AddProgress(id, amount)/DecreaseProgress(id, amount)for counter achievements (auto-completes when the target count is reached).UnlockBooleanAchievement(id)orSetBooleanAchievementCompleted(id, bool)for boolean achievements.- On unlock, the manager fires
OnAchievementUnlocked(payload),OnAchievementUnlockedSprite, andOnAchievementUnlockedString; any state change firesOnAchievementStateChanged. - UI:
Mn_DashboardCounterAchievements/Mn_DashboardBooleanAchievementsbuild rows from a database and refresh on state change;Mn_BooleanAchievementButton/Mn_CounterAchievementButtondrive a selected achievement from a UI Button;Mn_AchievementResetButtoncallsResetAllAchievementsToDefaultAndSave(). - Secret achievements (
isSecret) display???in their view-model until completed. - State is loaded in
Awakeand saved onOnApplicationQuit(when enabled) or viaSaveData().
Testing Scene
Open AchievementScene in the module's Debug/ folder.
What to do, in order:
- Unlock a boolean achievement, then try to unlock it a second time.
- Call AddProgress() on a counter one step at a time until it completes.
- Call DecreaseProgress() below zero.
- Stop play, start again, and check what survived.
Step 4 is the real test: progress is saved per achievement id, so renaming an id after release orphans everything stored under the old one. Step 1 checks the unlock is idempotent — an achievement that fires its reward twice is a bug players find before you do.
AchievementScene: four achievements unlocked one at a time — the faded ones are locked, the
solid ones unlocked — and then Reset all achievements, which puts every one of them back.
The buttons carry the achievement keys; the names and descriptions shown to a player live in
the two databases.
Technical Info
- Mn_AchievementManager: singleton core; keeps runtime dictionaries for counter/boolean state, builds view-models, raises unlock/state events, and implements
IAutoSaveObject(GetCurrentData,SaveData,LoadData,HasChanged). - Mn_DashboardCounterAchievements / Mn_DashboardBooleanAchievements: populate dashboard rows from a database and refresh when the manager reports changes.
- Mn_CounterAchievementButton / Mn_BooleanAchievementButton: hook a UI Button to a database-selected achievement id.
- Mn_CounterAchievementRowHolder / Mn_BooleanAchievementRowHolder: bind a single view-model to row UI widgets.
- Mn_AchievementResetButton: resets all achievements to default and saves.
- Data:
E_AchievementKind,S_AchievementSaveData,S_AchievementUnlockedEventData,S_CounterAchievementViewModel,S_BooleanAchievementViewModel, and theS_AchievementUnlocked*UnityEventserializable events.
© 2026 Marcello De Bonis. All rights reserved
Depends on 7
Used by 0
- No other module depends on it.
Measured from the repository: code references (asmdef) plus prefab and asset GUIDs. Importing this module alone brings in 15 modules in total.
UGTKengine within an engine


