Data Systems
Set up the two persistent manager singletons that handle save data and item look-ups. Both live on a GameObject in a scene that is never unloaded (or in the bootstrap scene).
1. Set up DatabaseManager
Create a persistent GameObject (e.g. on a "Managers" prefab) and add DatabaseManager.
- Assign the Items field with your ItemsReferences ScriptableObject asset.
On Awake, DatabaseManager groups all items by type into fast internal lookup tables. No further configuration is needed. Access the singleton via DatabaseManager.current.
See DatabaseManager.
2. Set up GameDataManager
Add GameDataManager to the same persistent GameObject.
- Assign Starting Inventory — the
InventoryPresetasset applied when no save file exists (first run).
The manager saves automatically whenever the player exits a level successfully and on application quit. You rarely need to call SaveNow() manually.
See GameDataManager.
Saving and reading level progress
To record a level result after the player succeeds, call:
GameDataManager.SaveLevel(levelData);
To read the best result for a level (for example, to initialize star markers on the world map):
LevelData data = GameDataManager.GetLevelData(levelInfo);
Both calls are static — no instance reference is needed.
Recording discovered equipment
When the player picks up or unlocks a new piece of equipment, record it so the equipment browser can display it:
GameDataManager.AddDiscoveredEquipment(equipment);
Read the full list at any time via GameDataManager.DiscoveredEquipment.