> ## Documentation Index
> Fetch the complete documentation index at: https://docs.encorekit.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GiftsButton

> The Unity API for the Gifts Button trigger component: create it from code or with EncoreGiftsButtonView, place it, and read its results.

The Unity form of the [Gifts Button](https://docs.encorekit.com/publishers/triggers/gifts-button.md) trigger component. The native button floats above the Unity view at a rect your game sets, and takes its height from the look Encore serves. After a claim it usually turns into the reminder look, so its height changes: listen to `HeightChanged`, or use `EncoreGiftsButtonView`, which resizes its element. Tapping it opens the reward sheet.

## Signature

```csharp theme={null}
public sealed class GiftsButton : EncoreTrigger
{
    public static GiftsButton Create(string placement, GiftsButtonOptions options = null);
}

public sealed class GiftsButtonOptions : TriggerOptions
{
}
```

`GiftsButton` is an [`EncoreTrigger`](https://docs.encorekit.com/publishers/unity/sdk-reference/encore-trigger) with the trigger ID `giftsButton` built in. Placing it, its height, its live setters, its `Result` event, and `Dispose()` are on [`EncoreTrigger`](https://docs.encorekit.com/publishers/unity/sdk-reference/encore-trigger#members), and every option is on [`TriggerOptions`](https://docs.encorekit.com/publishers/unity/sdk-reference/encore-trigger#signature).

`Create` throws `ArgumentException` for a blank placement.

## Example

```csharp theme={null}
using EncoreKit;
using UnityEngine;

public class DailyRewardsScreen : MonoBehaviour
{
    private GiftsButton _gifts;

    private void Start()
    {
        _gifts = GiftsButton.Create("daily_rewards", new GiftsButtonOptions { Headline = "You've got a gift" });
        _gifts.Result += result =>
        {
            if (result.Claim?.TransactionId is string transactionId) SaveClaim(transactionId);
        };
        _gifts.SetFrame(new Rect(40, Screen.height - 200, Screen.width - 80, 0));
    }

    public void OnPauseMenuShown() => _gifts.SetVisible(false);
    public void OnPauseMenuHidden() => _gifts.SetVisible(true);

    private void OnDestroy() => _gifts?.Dispose();

    private void SaveClaim(string transactionId) { /* your storage */ }
}
```

## EncoreGiftsButtonView

A `MonoBehaviour`, under **Add Component → Encore → Gifts Button**, that keeps the button over an empty `RectTransform` in your Canvas and follows it every frame as the layout moves or scales. It waits for `Encore.Configure`, then creates the button in its first `LateUpdate` after that.

```csharp theme={null}
public sealed class EncoreGiftsButtonView : EncoreTriggerViewBase
{
    public GiftsButton Button { get; }          // null until the button exists
}
```

Its Inspector fields, `Placement`, and `Result` are those of [`EncoreTriggerView`](https://docs.encorekit.com/publishers/unity/sdk-reference/encore-trigger#encoretriggerview), without `triggerId`.

## Notes

* After a claim, the button can turn into a Claim Reminder; see [After a claim](https://docs.encorekit.com/publishers/triggers/gifts-button.md#after-a-claim). It turns back after a later check of the claim confirms the completion (see [After a completion](https://docs.encorekit.com/publishers/triggers/gifts-button.md#after-a-completion)), which can take a few minutes.
* The rules every trigger component shares, such as drawing order, are in [`EncoreTrigger` notes](https://docs.encorekit.com/publishers/unity/sdk-reference/encore-trigger#notes).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.