Storage (required)
How it works
Implementation order
Load Data
bridge.storage.get(['key_1', 'key_2'])
.then(data => {
// Data loaded and you can work with it
// data[n] = null if there is no data for the given key
console.log('Data: ', data)
})
.catch(error => {
// Error, something went wrong
})private void Start()
{
Bridge.storage.Get(new List<string>() { "level", "coins" }, OnStorageGetCompleted);
}
private void OnStorageGetCompleted(bool success, List<string> data)
{
// Loading succeeded
if (success)
{
if (data[0] != null)
{
Debug.Log($"Level: {data[0]}");
}
else
{
// No data for the key 'level'
}
if (data[1] != null)
{
Debug.Log($"Coins: {data[1]}");
}
else
{
// No data for the key 'coins'
}
}
else
{
// Error, something went wrong
}
}
Save Data

Delete Data

Last updated