04 · Serverless Dual-Track Cloud Save
Transforms single-player games into cross-device cloud-roaming games without needing a custom database.
1. Global Lifecycle Management (Mandatory)
- Create a new empty
GameObjectin your first loading scene (name itSaveManager). - Click Add Component →
TelegramCloudSaveManager. - Check Sync On Start:
- On the first frame of game launch, automatically reconciles cloud and local timestamps
- When switching to the background, automatically flushes dirty data to the cloud
Zero-Code Experience
With Sync On Start enabled, cloud saving and loading require zero additional developer code.
2. Codeless UI Linkage
Data Display
Attach TelegramCloudDataText to a Coins/Level Text component:
| Field | Example |
|---|---|
| Data Key | GoldCoins |
| Format | Coins: {value} |
The text refreshes automatically whenever the value changes.
Data Increment / Modification
Attach TelegramCloudDataButton to a level completion or reward Button:
| Field | Value |
|---|---|
| Action Type | AddInt |
| Data Key | GoldCoins |
| Value | 100 |
| Auto Save To Cloud | ✅ Checked |
3. Instant 1-Second Replacement for Existing C# Code
In existing C# scripts, execute a global find-and-replace:
csharp
// Before
PlayerPrefs.SetInt("GoldCoins", value);
PlayerPrefs.GetInt("GoldCoins");
// After
TelegramPlayerPrefs.SetInt("GoldCoins", value);
TelegramPlayerPrefs.GetInt("GoldCoins");Offline data I/O is instantly upgraded to in-memory caching paired with Telegram's free cloud persistence and cross-device roaming.
Demo Reference
See Packages/com.fasttma.core/Samples/04_CloudSave for the full Demo implementation.