Working With Assets For Player in Game

Get All Key Value Pairs to an Instance

Unity
1
LootLockerSDKManager.GetAllKeyValuePairsToAnInstance(45781352, (response) =>
2
{
3
if (response.success)
4
{
5
if (response.storage.Length > 0)
6
{
7
Debug.Log("Successfully retrieved " + response.storage.Length + " key value pairs");
8
}
9
else
10
{
11
Debug.Log("No key value pairs for asset instance");
12
}
13
}
14
else
15
{
16
Debug.Log("Error retrieving assets");
17
}
18
});
Copied!

Get A Key Value Pair By Id

Unity
1
int assetInstanceID = 84;
2
int keyValueID = 1;
3
LootLockerSDKManager.GetAKeyValuePairByIdForAssetInstances(assetInstanceID, keyValueID, (response) =>
4
{
5
if (response.success)
6
{
7
Debug.Log("Successfully retrieved key value pair");
8
}
9
else
10
{
11
Debug.Log("Error retrieving key value pair");
12
}
13
});
Copied!

Create A Key Value Pair

Unity
1
LootLockerSDKManager.CreateKeyValuePairForAssetInstances(45781352, "some-new-key", "value here", (response) =>
2
{
3
if (response.success)
4
{
5
Debug.Log("Successfully created key value pair for asset instance");
6
}
7
else
8
{
9
Debug.Log("Error creating key value pair");
10
}
11
});
Copied!

Update One Or More Key Value Pairs

Unity
1
int assetInstanceID = 84;
2
3
Dictionary<string, string> multipleTestKeys = new Dictionary<string, string>();
4
5
multipleTestKeys.Add("some-new-key", "Some value");
6
multipleTestKeys.Add("some-other-key", "Some other value");
7
LootLockerSDKManager.UpdateOneOrMoreKeyValuePairForAssetInstances(assetInstanceID, multipleTestKeys, (response) =>
8
{
9
if (response.success)
10
{
11
Debug.Log("Successfully updated key value pairs");
12
}
13
else
14
{
15
Debug.Log("Error updating key value pairs");
16
}
17
});
Copied!

Delete Key Value Pair

Unity
1
int assetInstanceID = 84;
2
int keyValuePairID = 1;
3
4
LootLockerSDKManager.DeleteKeyValuePairForAssetInstances(assetInstanceID, keyValuePairID, (response) =>
5
{
6
if (response.success)
7
{
8
Debug.Log("Successfully removed key value pair");
9
}
10
else
11
{
12
Debug.Log("Error removing key value pair");
13
}
14
});
Copied!
Last modified 1mo ago