Working With Assets For Player in Game

Get All Key Value Pairs to an Instance

Unity
LootLockerSDKManager.GetAllKeyValuePairsToAnInstance(45781352, (response) =>
{
if (response.success)
{
if (response.storage.Length > 0)
{
Debug.Log("Successfully retrieved " + response.storage.Length + " key value pairs");
}
else
{
Debug.Log("No key value pairs for asset instance");
}
}
else
{
Debug.Log("Error retrieving assets");
}
});

Get A Key Value Pair By Id

Unity
int assetInstanceID = 84;
int keyValueID = 1;
LootLockerSDKManager.GetAKeyValuePairByIdForAssetInstances(assetInstanceID, keyValueID, (response) =>
{
if (response.success)
{
Debug.Log("Successfully retrieved key value pair");
}
else
{
Debug.Log("Error retrieving key value pair");
}
});

Create A Key Value Pair

Unity
LootLockerSDKManager.CreateKeyValuePairForAssetInstances(45781352, "some-new-key", "value here", (response) =>
{
if (response.success)
{
Debug.Log("Successfully created key value pair for asset instance");
}
else
{
Debug.Log("Error creating key value pair");
}
});

Update One Or More Key Value Pairs

Unity
int assetInstanceID = 84;
Dictionary<string, string> multipleTestKeys = new Dictionary<string, string>();
multipleTestKeys.Add("some-new-key", "Some value");
multipleTestKeys.Add("some-other-key", "Some other value");
LootLockerSDKManager.UpdateOneOrMoreKeyValuePairForAssetInstances(assetInstanceID, multipleTestKeys, (response) =>
{
if (response.success)
{
Debug.Log("Successfully updated key value pairs");
}
else
{
Debug.Log("Error updating key value pairs");
}
});

Delete Key Value Pair

Unity
int assetInstanceID = 84;
int keyValuePairID = 1;
LootLockerSDKManager.DeleteKeyValuePairForAssetInstances(assetInstanceID, keyValuePairID, (response) =>
{
if (response.success)
{
Debug.Log("Successfully removed key value pair");
}
else
{
Debug.Log("Error removing key value pair");
}
});
Copy link
On this page
Get All Key Value Pairs to an Instance
Get A Key Value Pair By Id
Create A Key Value Pair
Update One Or More Key Value Pairs
Delete Key Value Pair