Player Storage
Player storage allows you to store key/value data on the player. Storage items can be private or public, making possible

Retrieve Player Storage

To view Player storage in the web console, go to the player and select the storage tab. From here it's possible to view and edit the data for the player.

Retrieve Entire Player Storage From Game

Unity
1
LootLockerSDKManager.GetEntirePersistentStorage((response) =>
2
{
3
if (response.success)
4
{
5
Debug.Log("Successfully retrieved player storage: " + response.payload.Length);
6
} else
7
{
8
Debug.Log("Error getting player storage");
9
}
10
});
Copied!

Retrieve Single Storage Value From Game

Unity
1
string key = "some-key";
2
LootLockerSDKManager.GetSingleKeyPersistentStorage(key, (response) =>
3
{
4
if (response.success)
5
{
6
if (response.payload != null)
7
{
8
Debug.Log("Successfully retrieved player storage with value: " + response.payload.value);
9
} else
10
{
11
Debug.Log("Item with key " + key + " does not exist");
12
}
13
} else
14
{
15
Debug.Log("Error getting player storage");
16
}
17
});
Copied!

Update Player Storage

To update a single value for a key
Unity
1
LootLockerSDKManager.UpdateOrCreateKeyValue("some-key", "some new value", (getPersistentStoragResponse) =>
2
{
3
if (getPersistentStoragResponse.success)
4
{
5
Debug.Log("Successfully updated player storage");
6
}
7
else
8
{
9
Debug.Log("Error updating player storage");
10
}
11
});
Copied!
To update or create multiple keys at the same time
Unity
1
LootLockerGetPersistentStorageRequest data = new LootLockerGetPersistentStorageRequest();
2
data.AddToPayload(new LootLockerPayload { key = "some-key", value = "Some new value" });
3
data.AddToPayload(new LootLockerPayload { key = "some-other-key", value = "Some other new value" });
4
5
LootLockerSDKManager.UpdateOrCreateKeyValue(data, (getPersistentStoragResponse) =>
6
{
7
if (getPersistentStoragResponse.success)
8
{
9
Debug.Log("Successfully updated player storage");
10
}
11
else
12
{
13
Debug.Log("Error updating player storage");
14
}
15
});
Copied!

Remove Player Storage Item

For this you need the public UID of the other player.
Unity
1
LootLockerSDKManager.DeleteKeyValue("some-key", (getPersistentStoragResponse) =>
2
{
3
if (getPersistentStoragResponse.success)
4
{
5
Debug.Log("Successfully removed key from player storage");
6
}
7
else
8
{
9
Debug.Log("Error removing key from player storage");
10
}
11
});
Copied!

Get Other Players Public Storage

Unity
1
LootLockerSDKManager.GetOtherPlayersPublicKeyValuePairs("92AR9254", (response) =>
2
{
3
if (response.success)
4
{
5
Debug.Log("Successfully retrieved storage for other player " + response.payload.Length);
6
}
7
else
8
{
9
Debug.Log("Error retrieving storage for other player");
10
}
11
});
Copied!
Last modified 1mo ago