TudadaStore API
TudadaStore API (Cloud Storage)
Saves data to the cloud regardless of the device. Data persists even when switching devices.
Capacity Limit: Max 2KB per value
TudadaStoreSave(key, value, onSuccess, onFail)
Saves data to the cloud.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
key | string | ✅ | Key to save |
value | string | ✅ | Data to save (max 2KB) |
onSuccess | Action<TudadaStoreSaveResult> | - | Success callback |
onFail | Action<string> | - | Failure callback |
TudadaSDK.Instance.TudadaStoreSave("gameState",
JsonUtility.ToJson(new GameState { level = 5, coins = 300 }),
onSuccess: (result) => Debug.Log("Cloud save complete"),
onFail: (err) => Debug.LogError("Save failed: " + err)
);
TudadaStoreGet(key, onSuccess, onFail)
Retrieves data from the cloud.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
key | string | ✅ | Key to retrieve |
onSuccess | Action<TudadaStoreGetResult> | - | Success callback |
onFail | Action<string> | - | Failure callback |
Success Response (TudadaStoreGetResult):
| Field | Type | Description |
|---|---|---|
value | string | Retrieved data (empty string if not found) |
TudadaSDK.Instance.TudadaStoreGet("gameState",
onSuccess: (result) => {
if (!string.IsNullOrEmpty(result.value))
{
var state = JsonUtility.FromJson<GameState>(result.value);
Debug.Log("Level: " + state.level);
}
else
{
Debug.Log("No saved data");
}
},
onFail: (err) => Debug.LogError("Query failed: " + err)
);
[System.Serializable]
public class GameState
{
public int level;
public int coins;
}