Invoke trigger from game
Prerequisites
// If you want to check and notify the player of what they received, save the keys of the successfully invoked triggers
List<string> successfulKeys = new List<string>();
LootLockerSDKManager.InvokeTriggersByKey(new string[] { "key_one", "key_two" }, (response) =>
{
if (response.success)
{
// Even if keys fails, the call is successful, so you need to check which triggers were successful and which ones failed
foreach (var item in response.Successful_keys)
{
Debug.Log("Key " + item.Key + " was successfully invoked.");
// Save this key if you want the check what the player got
successfulKeys.Add(item.Key);
// Add your own code here to handle successful keys
}
foreach (var item in response.Failed_keys)
{
Debug.LogWarning("Key " + item.Key + " failed with reason:"+item.reason);
// Add your own code here to handle the error
}
// Here you would put code to check notifications for what the player received.
}
else
{
Debug.Log(response.errorData.message);
// Add your own code here to handle the error
}
});
Conclusion
Last updated
Was this helpful?
