Skip to main content

In-App Notifications

Don't build a custom "Are you sure?" panel for every screen. Use the centralized HookInAppNotifications.

Setup

  1. Drag the HookInAppNotifications prefab (Runtime/Prefabs/HookInAppNotifications.prefab) into your layout, usually inside a generic "Popups" Canvas. It's a Singleton, so one instance is enough for the whole game.
  2. Assign the references (Title, Message, Buttons, etc.) in the Inspector if you build your own instead of using the prefab.
  3. Ensure it is initialized (it is a Singleton).

Usages

1. Simple Info

Just tell the user something happened.

HookInAppNotifications.Show("Success", "Game Saved!", "Great");

2. Confirmation (Lambda)

Ask for a decision.

HookInAppNotifications.Show(
"Delete Save?",
"This action cannot be undone.",
() => { DeleteSave(); }, // On Confirm
() => { Debug.Log("Safe"); }, // On Cancel
"Delete", // Confirm Button Text
"Cancel" // Cancel Button Text
);

3. Advanced (PromptData)

Fully customize icon, texts, and callbacks using the data object builder.

var data = new PromptData("Purchase", "Buy Sword?")
.WithIcon(swordSprite)
.WithPrimaryText("Buy ($50)")
.WithSecondaryText("Leave");

data.OnPrimary = TryBuy;

HookInAppNotifications.Show(data);

Input Blocking

The system automatically uses HookInputBlocker to prevent clicks on the UI behind it while open.