Contents
Prefabs
Reference prefabs for the popup system. Copy these into your project as a starting point. After copying, add entries to your PopupSettings asset's Element Prefabs list mapping PopupElementType values to these prefabs.
| Prefab |
PopupElementType |
Description |
PopupReferencePrefab |
N/A |
Main popup container with Canvas, CanvasGroup, Background, and Content |
PopupHeader |
Header ("header") |
Header text element (TMP_Text, bold, larger font) |
PopupText |
Text ("text") |
Body text element (TMP_Text, regular) |
PopupStat |
LabelValueText ("label_value_text") |
Label + value row (HorizontalLayoutGroup with two TMP_Text children) |
PopupIcon |
Image ("image") |
Image element for icons or artwork |
PopupSeparator |
Separator ("separator") |
Horizontal divider line (Image, thin) |
To add variants, duplicate a prefab, style it differently, and register it with a variant type. Use PopupElementType.Header.Variant("gold") in code, and set the type to "header_gold" in the PopupSettings Inspector.
Settings
| Asset |
Description |
PopupSettings |
Pre-configured PopupSettings ScriptableObject with sensible defaults |
Scripts
| Script |
Description |
PopupSystemExample |
Basic setup with auto-scanned triggers, GetTriggerHandler by name, and GetTriggerHandlers by category |
DynamicTriggersExample |
Setting up triggers on dynamically instantiated UI using InitializeTriggersInChildren with (trigger, view) callback |
CodeOnlyPopupExample |
Showing popups from code (anchored, fixed position, follow mouse), PopupElementType variants, and generic Add() for custom types |
Architecture Overview
How to use
- Import the samples via the Unity Package Manager (select the package, expand Samples, click Import)
- Copy the prefabs into your project's Prefabs folder
- Create a PopupSettings asset or use the provided one
- Add Element Prefab entries to PopupSettings using the dropdown (Header, Text, LabelValueText, Image, Separator) mapped to the copied prefabs
- Reference the example scripts for integration patterns