Remote Storage
Installation
Complete the steps in Getting Started if LionSDK is not installed.
If LionSDK is already installed,
Install the package
Lion - Remote Storage.

Make sure the “Hide Package” button is disabled to see the relevant package folders.

Quick Start
Setup Firebase.
Setup Firestore.
If integrated, users will be able to retrieve game data even after reinstall.
Setup Facebook Authentication (Optional, but recommended, if you want Facebook login data sync)
If integrated, users will be able to retrieve game data from their other devices after a Facebook login.
Implementation
Reading & Writing Data
All reads and writes are instant and local:
RemoteStorage.SetInt("coins", 100);
int coins = RemoteStorage.GetInt("coins", 0);
RemoteStorage.SetValue("profile", playerProfile);Saving to the Cloud
Cloud saving is manual — call the awaitable Save() Whenever you want to push data to the cloud:
bool synced = await RemoteStorage.Save();
if (!synced)
{
// Cloud unreachable
}Returns
trueonce the data has reached the cloud.Returns
falseIf the cloud cannot be reached, local data is safe.If authentication or the first sync failed (for example, the game started offline), the next
Save()sync recovers by itself — it authenticates, pulls and merges the cloud save, then pushes.OnRemoteDataUpdatedfires if the cloud save wins that merge.
Using the OnRemoteDataUpdated Event
OnRemoteDataUpdated EventWhen data is synced from the cloud, a merge conflict may occur between local and remote data. If the remote data wins (because it has a more recent purchase, higher XP, or newer save time), the local data is replaced.
When this happens, RemoteStorage.OnRemoteDataUpdated fires so your game can reload its in-memory state. This is also the right moment to tell the player their progress was restored — for example, show a popup saying the save was loaded from the cloud.
RemoteStorage.OnRemoteDataUpdated += () =>
{
// Cloud data replaced local data — reload your in-memory state
coins = RemoteStorage.GetInt("coins", 0);
volume = RemoteStorage.GetFloat("volume", 1f);
playerProfile = RemoteStorage.GetValue<PlayerProfile>("profile", new PlayerProfile());
};If you cache storage values in memory (e.g. at game start), those cached values will be stale after a cloud merge. Always listen to OnRemoteDataUpdated and re-read your data to keep your game state in sync.
Last updated
Was this helpful?