Scripting / UI
NotificationLayout
Generic toast notification pop-up that displays an icon and message for 7 seconds, then auto-dismisses. The timer runs unscaled so notifications remain visible even when the game is paused.
Methods
| Method | Description |
|---|---|
CreateInstance( | Instantiates the prefab, configures it with the given icon and message, then plays the slide-in animation. Returns the new NotificationLayout instance. Pass null for parent to use the prefab's default parent. |
Close() | Plays the slide-out animation and destroys the instance when it finishes. Call this to dismiss before the 7-second timer expires. |
Inspector Fields
| Field | Type | Description |
|---|---|---|
icon | Image | Image component that receives the sprite passed to CreateInstance. |
message | TMP_Text | Text label that receives the message string. |
content | RectTransform | The animated container driven by the slide-in/out animation. |
Usage Example
[SerializeField] NotificationLayout notificationPrefab;
// show a toast with an item icon
notificationPrefab.CreateInstance(item.image, $"{item.displayName} collected!", transform);
See also: EquipmentNotification