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.
Unity
1
string triggerName = "test";
2
LootLockerSDKManager.TriggeringAnEvent(triggerName, (response) =>
3
{
4
if (response.success)
5
{
6
Debug.Log("Successfully triggered event");
7
}
8
else
9
{
10
Debug.Log("Error triggering event");
11
}
12
});
Copied!
To learn more about the endpoint you can check out our reference documentation on triggering an event

Retrieving Previously Triggered Triggers

Unity
1
LootLockerSDKManager.ListingTriggeredTriggerEvents((response) =>
2
{
3
if (response.success)
4
{
5
Debug.Log("Successfully retrieved triggered events");
6
}
7
else
8
{
9
Debug.Log("Error retrieving triggered events");
10
}
11
});
Copied!
Last modified 1mo ago