Work With Triggers in Game

The following tutorial assumes you have already set up your game and made your first API calls. To learn how to do that, visit the Getting Started guide.

After settings up some triggers in the console we can implement it in the game.

Trigger Event

Calling this in the game will award the player with any score/XP or assets we set up while create the trigger.

string triggerName = "test";
LootLockerSDKManager.ExecuteTrigger(triggerName, (response) =>
{
    if (response.success)
    {
        Debug.Log("Successfully triggered event");
    }
    else
    {
        Debug.Log("Error triggering event");
    }
});

To learn more about the endpoint you can check out our reference documentation on triggering an event

Retrieving Previously Triggered Triggers

LootLockerSDKManager.ListExecutedTriggers((response) =>
{
    if (response.success)
    {
        Debug.Log("Successfully retrieved triggered events");
    }
    else
    {
        Debug.Log("Error retrieving triggered events");
    }
});

Last updated