TudadaStore API
TudadaStore API (클라우드 스토리지)
디바이스와 무관하게 데이터를 클라우드에 저장합니다. 기기 변경 시에도 데이터가 유지됩니다.
용량 제한: value 최대 2KB
TudadaStoreSave(key, value, onSuccess, onFail)
클라우드에 데이터를 저장합니다.
파라미터:
| 파라미터 | 타입 | 필수 | 설명 |
|---|---|---|---|
key | string | ✅ | 저장할 키 |
value | string | ✅ | 저장할 데이터 (최대 2KB) |
onSuccess | Action<TudadaStoreSaveResult> | - | 성공 콜백 |
onFail | Action<string> | - | 실패 콜백 |
TudadaSDK.Instance.TudadaStoreSave("gameState",
JsonUtility.ToJson(new GameState { level = 5, coins = 300 }),
onSuccess: (result) => Debug.Log("클라우드 저장 완료"),
onFail: (err) => Debug.LogError("저장 실패: " + err)
);
TudadaStoreGet(key, onSuccess, onFail)
클라우드에서 데이터를 조회합니다.
파라미터:
| 파라미터 | 타입 | 필수 | 설명 |
|---|---|---|---|
key | string | ✅ | 조회할 키 |
onSuccess | Action<TudadaStoreGetResult> | - | 성공 콜백 |
onFail | Action<string> | - | 실패 콜백 |
성공 응답 (TudadaStoreGetResult):
| 필드 | 타입 | 설명 |
|---|---|---|
value | string | 조회된 데이터 (없으면 빈 문자열) |
TudadaSDK.Instance.TudadaStoreGet("gameState",
onSuccess: (result) => {
if (!string.IsNullOrEmpty(result.value))
{
var state = JsonUtility.FromJson<GameState>(result.value);
Debug.Log("레벨: " + state.level);
}
else
{
Debug.Log("저장된 데이터 없음");
}
},
onFail: (err) => Debug.LogError("조회 실패: " + err)
);
[System.Serializable]
public class GameState
{
public int level;
public int coins;
}