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, too, after Facebook login.
When to use?
What it is: Cloudβbacked keyβvalue store with crossβdevice sync. Optional Facebook Login for identity; otherwise uses deviceβscoped IDs.
When to use it: You want user data to survive reinstalls and sync across devices.
Good for: Crossβdevice progression, restore after reinstall, serverβadjacent features.
Pros
Persists across reinstalls and devices
Builtβin merge/conflict handling (via
MergeConflictData)Works with social platforms (like
Facebook)Nonβblocking β does not delay game startup
Cons
Requires Firebase project setup
Network latency and offline retry logic apply
How It Works (Architecture Overview)
Remote Storage uses a localβfirst architecture. All reads and writes go to local storage (PlayerPrefs) instantly. Cloud synchronization with Firestore happens in the background, so it never blocks your game.
Game Code β LionStorage API β LocalStorage (PlayerPrefs) β instant reads/writes
β
CloudSyncManager (background)
β
Firestore (cloud)Initialization Flow
Initialize()loads data from PlayerPrefs immediately and returns without waiting for the cloud.Background sync starts: Firebase Email/Password auth β pull remote data β merge β push.
Remote Storage does NOT block LionSDK initialization.
Background Cloud Sync

Once initialized, the system automatically pushes data to Firestore:
Sync Interval Seconds β pushes every 30 seconds by default (configurable via
_syncIntervalSecondson the Firestore ScriptableObject in the Inspector).Sync On Application Pause β pushes when the app is paused/backgrounded (enabled by default).
SyncState API
Use the SyncState API to monitor the current status of the cloud synchronization.
SyncState Enum
LocalOnly
No cloud connection (initial state, or auth failed).
Authenticating
Firebase email auth is in progress.
Syncing
Pulling or pushing data to Firestore.
Synced
Cloud and local data are in sync.
Failed
Auth or sync failed. Local data is safe and playable.
Checking Current State
if (RemoteStorage.CurrentSyncState == SyncState.Synced)
{
Debug.Log("Cloud data is in sync!");
}Subscribing to State Changes
RemoteStorage.OnSyncStateChanged += (state) =>
{
Debug.Log($"Sync state changed: {state}");
if (state == SyncState.Failed)
{
// Show offline indicator to the player
}
};Using the OnDataMergedFromCloud Event
OnDataMergedFromCloud 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, LionStorage.OnDataMergedFromCloud fires so your game can reload its inβmemory state.
LionStorage.OnDataMergedFromCloud += () =>
{
// Cloud data replaced local data β reload your in-memory state
coins = LionStorage.GetInt("coins", 0);
volume = LionStorage.GetFloat("volume", 1f);
playerProfile = LionStorage.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 OnDataMergedFromCloud and re-read your data to keep your game state in sync.
RemoteStorage Static API
IsInitialized
bool
true once the module has completed initialization (local data loaded).
OnInitialized
event Action
Fires when initialization completes.
CurrentSyncState
SyncState
Current cloud sync state.
OnSyncStateChanged
event Action<SyncState>
Fires when sync state changes.
CurrentMergeConflictData
MergeConflictData
The current merge conflict data from the active storage, or null.
Last updated
Was this helpful?