Cloud Storage
The Cloud Storage feature in the Yandex Games SDK for Unity allows you to save and retrieve player data on Yandex’s cloud server. This enables the persistence of game progress, allowing players to access their data across devices and sessions.
Overview
With Cloud Storage, you can:
Save player data: Store game progress, scores, or custom data for each player.
Load player data: Retrieve previously saved data to resume game progress.
Flush data: Commit pending saves to ensure data consistency.
Basic Usage Examples
Below are quick examples for saving and loading data in the cloud without the need for complex structures or JSON conversions.
1. Saving Data to the Cloud
To save data, specify a key and the data object you want to store. The SDK automatically handles data serialization.
Key:
"playerProfile"
is used as the identifier for the data.Data:
playerData
is stored directly; no JSON conversion is needed.Callback: The callback checks if the save operation was successful.
2. Loading Data from the Cloud
To load data, use the same key that was used to save it.
Key: The
"playerProfile"
key is used to retrieve the data.Data Type: Specify
PlayerData
the type for the loaded data.Callback: If data loads successfully, it’s passed to
ApplyLoadedData
for further use.
3. Flushing Data to Ensure Consistency
Flushing data ensures that all pending saves are committed to the cloud immediately. This is useful to minimize data loss in case of unexpected game closures.
Flushing data is recommended after critical saves, such as level completion or other important milestones.
Additional Tips
Unique Keys: Use unique keys for different types of data to prevent conflicts (e.g.,
"playerProfile"
,"gameSettings"
).Data Integrity: Regularly save and flush data at key game points to maintain data integrity.
Last updated
Was this helpful?