Skip to content

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)

  1. Create a new empty GameObject in your first loading scene (name it SaveManager).
  2. Click Add Component → TelegramCloudSaveManager.
  3. 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:

FieldExample
Data KeyGoldCoins
FormatCoins: {value}

The text refreshes automatically whenever the value changes.

Data Increment / Modification

Attach TelegramCloudDataButton to a level completion or reward Button:

FieldValue
Action TypeAddInt
Data KeyGoldCoins
Value100
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.