# Activate a trigger

{% hint style="info" %}
You are viewing legacy triggers. We've launched a new trigger system, it's much more powerful and flexible! [Check it out!](https://docs.lootlocker.com/game-systems/triggers)
{% endhint %}

## Work With Triggers in Game

{% hint style="warning" %}
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](https://docs.lootlocker.com/the-basics/readme) guide.
{% endhint %}

After [settings up some triggers](https://docs.lootlocker.com/legacy/triggers/create-a-trigger) 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.

{% tabs %}
{% tab title="Unity" %}

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

{% endtab %}

{% tab title="Unreal" %}

<figure><img src="https://534367586-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MVu1MPzezO-NgvC98xh%2Fuploads%2Fgit-blob-481a851e79bd4aef3b3f20fcb834794f155bfeab%2Fimage.png?alt=media" alt=""><figcaption><p><a href="https://blueprintue.com/blueprint/re0lw8x4">Blueprint example of executing a trigger</a></p></figcaption></figure>
{% endtab %}
{% endtabs %}

To learn more about the endpoint you can check out our reference documentation on [triggering an event](https://ref.lootlocker.io/game-api/#triggering-an-event)

#### Retrieving Previously Triggered Triggers

{% tabs %}
{% tab title="Unity" %}

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

{% endtab %}

{% tab title="Unreal" %}

<figure><img src="https://534367586-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MVu1MPzezO-NgvC98xh%2Fuploads%2Fgit-blob-a71be6cfc79f8864fb03f7e80ba6e7a710a9651d%2Fimage.png?alt=media" alt=""><figcaption><p><a href="https://blueprintue.com/blueprint/u90ze_4e/">Blueprint example of getting a list of previously triggered triggers</a></p></figcaption></figure>
{% endtab %}
{% endtabs %}
