Methods

MethodDescription
CreateInstance(
  Sprite icon,
  string message,
  Transform parent = null)
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

FieldTypeDescription
iconImageImage component that receives the sprite passed to CreateInstance.
messageTMP_TextText label that receives the message string.
contentRectTransformThe 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);
ℹ️