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

# UI components

> The Almedia API — SDK 1.3.0 and newer. Synced from the source repository.

The bundled UI controllers live in `AlmediaLink.UI`. The `AlmediaLinkPopupController` base class the popup is built on is in the `AlmediaSDK` namespace and ships in the `AlmediaLink` assembly. The SDK ships ready-to-drop prefabs in `Packages/com.almedia.sdk/Runtime/Prefabs/`; host code never needs to instantiate or call into the controllers directly. Customize by editing a prefab, creating a Prefab Variant, or deriving your popup from the base class. The popup, card, and overlay prefabs each carry an **Apply Host Settings** checkbox controlling whether the text/colors from **Almedia → Settings** are applied to them at runtime - untick it on a fully hand-authored variant.

***

## `AlmediaLinkPopupController`

Namespace: `AlmediaSDK` · assembly `AlmediaLink` · abstract `MonoBehaviour`

The base of the component that shows the link popup. [`ShowLink()`](https://docs.almedia.dev/technical/api-reference/almedia/almedia-methods#static-void-showlink) and the `LinkButton` prefab instantiate the assigned prefab once, as a root object kept across scenes, and open it on every call. `LinkPopupController` derives from it, and so can your own popup; see [Your own popup design](https://docs.almedia.dev/technical/integration-guide/the-linking-flow.md#your-own-popup-design).

| Member | Description |
| - | - |
| `static event Action<AlmediaLinkSource> OnShown` | A popup opened. Once per open, after `ShowPopup` returned. The return after the player cancels the linking screen does not fire it. |
| `static event Action<AlmediaLinkSource> OnCtaClicked` | The player tapped the popup's button. Linking starts right after. Can fire more than once per open. |
| `static event Action<AlmediaLinkSource> OnDismissed` | The player closed the popup without linking. |
| `protected AlmediaLinkSource Source` | What opened the popup. Set before `ShowPopup` runs, null while the popup is closed. |
| `protected abstract void ShowPopup()` | Shows the visuals. Called when the popup opens, and again when the player closes the linking screen without linking. |
| `protected abstract void HidePopup()` | Hides the visuals. Called when the popup closes, and when the linking screen covers it. |
| `protected void StartLinking()` | Call from the popup's button. Records the tap, raises `OnCtaClicked` and starts linking with the `Popup` placement. |
| `protected void Dismiss()` | Call from the close button. Records the dismiss, raises `OnDismissed` and hides the popup. |

The events fire for every popup built on this class: the bundled `LinkPopup`, a Prefab Variant of it and your own subclass. Subscribe once at app start; no popup reference is needed. Each event fires at the moment the SDK records the same action, so your counts and Almedia's agree. The events are cleared on domain reload, not by `Initialize`. A subscriber that throws is reported through `OnLog` at `Error` and the others still run.

The SDK closes the popup when linking completes or fails, when the player can no longer link, and when another SDK screen opens. None of those raises an event. `StartLinking` and `Dismiss` do nothing while the popup is not open, while it waits behind the linking screen, and inside `ShowPopup`. An exception thrown by `ShowPopup` while the popup opens is logged through `OnLog` at `Error` and the popup is removed. It counts no show and raises no event. The next `ShowLink()` instantiates it again.

***

## `LinkButtonController`

The component on the `LinkButton` prefabs. Two-state: visible while `Eligible` (a linking entry - tapping opens the `LinkPopup`) and while `Linked` **with the reward hub available** (a rewards entry - tapping opens it via `ShowRewardHub()`); hidden in every other case, including a linked player whose `CanShowRewardHub` is `false`. Hiding is deliberate there: showing the eligible state to a linked player would be wrong, and a rewards button that opens nothing is the failure this exists to remove. Promo tracking follows what is shown, so that case reports `promo_load` with `Hidden`.

The controller follows the status live, so a reward hub withdrawn mid-session hides the button. Each state is a self-contained subtree in the prefab (`Eligible` / `Linked`, each pairing a content object with its own button and background), so its art and press colours are authored in the prefab and the controller only toggles which one shows.

Drop one of the four `LinkButton` variants (`LinkButtonA`-`LinkButtonD`) into your Canvas - no code needed. With **Auto-Initialize From Prefabs** enabled in **Almedia → Settings**, the button calls `Initialize` with the settings values when nothing has called it by the end of its first frame. An earlier call of your own runs first, and a later call with a different configuration takes over. See [Initialize the SDK](https://docs.almedia.dev/technical/integration-guide/initialize-the-sdk.md).

To reproduce the behaviour on a button of your own, call [`ShowLink()`](https://docs.almedia.dev/technical/api-reference/almedia/almedia-methods#static-void-showlink) while the status is `Eligible`, and [`ShowRewardHub()`](https://docs.almedia.dev/technical/api-reference/almedia/almedia-methods#static-void-showrewardhub) while the status is `Linked` with `CanShowRewardHub`. `ShowLink()` shows the popup from the settings' **Link Popup** slot, not the button's reference.

The button also carries the **Link Popup** reference it opens on an eligible tap. Assign a Prefab Variant, or a prefab with your own [`AlmediaLinkPopupController`](https://docs.almedia.dev/technical/api-reference/almedia/ui-components#almedialinkpopupcontroller), to customize the popup; with the field emptied, an eligible tap starts linking directly (with a one-time warning). **Source Name**, `link_button` by default, is the name the popup opened by this button reports through the `AlmediaLinkPopupController` events, with kind `LinkButton`. Give each button its own name to tell them apart.

***

## `LinkPopupController`

The component on the `LinkPopup` prefab, derived from [`AlmediaLinkPopupController`](https://docs.almedia.dev/technical/api-reference/almedia/ui-components#almedialinkpopupcontroller). Renders the modal account-linking popup; the CTA button starts linking, and the popup closes itself on the close button, when linking completes, and when the player can no longer link. While the in-app linking screen is open, the popup is hidden. It comes back when the player closes that screen without linking. Any other SDK screen closes the popup. The SDK instantiates the prefab once and reuses the instance.

`Show()` and `Show(AlmediaLinkSource source)` open an instance you created yourself and report it through the base class events, with `AlmediaLinkSource.ShowLink` when no source is given. A call on an instance that is already open does nothing. Another link popup that is open closes first, without a dismiss; one popup is open at a time. Prefer [`ShowLink()`](https://docs.almedia.dev/technical/api-reference/almedia/almedia-methods#static-void-showlink), which also checks the player's status first.

Customize via Prefab Variant assigned on the `LinkButton` prefab's **Link Popup** field, and for [`ShowLink()`](https://docs.almedia.dev/technical/api-reference/almedia/almedia-methods#static-void-showlink) in **Almedia → Settings → Default UI Prefabs → Link Popup**. Text and colors are also directly editable in **Almedia → Settings → Link Popup Text**, applied while the popup's **Apply Host Settings** checkbox is ticked.

***

## `NotificationCardController`

The component on the `NotificationCard` prefab. Slides up from the bottom when notifications arrive, auto-dismisses after a few seconds, and opens the `ActivityOverlay` if multiple notifications stack.

Customize via Prefab Variant assigned in **Almedia → Settings → Default UI Prefabs → Notification Card**. The dismiss delay and bottom padding are inspector-tunable on the prefab.

***

## `ActivityOverlayController`

The component on the `ActivityOverlay` prefab. Full-screen notification list, opened by tapping a stacked `NotificationCard`.

Customize via Prefab Variant assigned in **Almedia → Settings → Default UI Prefabs → Activity Overlay**.

***


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