Skip to content

Cloud storage (Cocos)

Cloud storage is keyed off the player’s FRVR auth session — it follows them across devices, browsers, and channels.

Same API shape as local storage, different persistence layer.

await FRVRSDK.instance.cloudStorageSetItem('save', gameState);

const save = await FRVRSDK.instance.cloudStorageGetItem('save');
if (save) restoreGame(save);

await FRVRSDK.instance.cloudStorageRemoveItem('save');

Values are JSON‑serializable — the wrapper handles serialization.

await FRVRSDK.instance.cloudStorageSetItems([
  { key: 'save',     value: gameState },
  { key: 'unlocked', value: unlockedSet },
]);

const items = await FRVRSDK.instance.cloudStorageGetItems(['save', 'unlocked']);

await FRVRSDK.instance.cloudStorageRemoveItems(['legacy_save_v1']);

A missing cloud value can mean:

  • A genuinely new player
  • Auth hasn’t resolved yet this session
  • A transient network blip

If you’re about to write a fresh save because you read nothing, debounce — read again after a short delay or after auth resolves, and only treat empty as “new” once you’re confident auth is ready.

const save = await FRVRSDK.instance.cloudStorageGetItem('save');
if (!save) {
  // TODO: verify the player is authenticated before treating this as a new account
}

See Local storage § When to use local vs. cloud.