docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class ToastManager

    The global toast stack: a capped, newest-first list of ToastEntry that every mounted Toaster renders.

    Inheritance
    object
    ToastManager
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.AppUI.UI
    Assembly: Unity.AppUI.dll
    Syntax
    public static class ToastManager
    Remarks

    This is the stacking counterpart of Toast. A Toast is a single PopupNotification<T> shown one at a time by the notification manager; ToastManager instead keeps up to limit messages visible at once so several results can be reported without one replacing the next.

    The store is global and view-independent, which is the point: any code — including code with no VisualElement at hand — can post a toast, and whichever Toaster hosts are mounted display it.

    Examples
    // Mount one host, usually next to the app root.
    panel.Add(new Toaster { anchor = PopupNotificationPlacement.BottomRight, limit = 3 });
    
    // Then post from anywhere.
    ToastManager.Add("Scene saved", NotificationStyle.Positive, "check");
    
    // Or keep the handle and update it in place.
    var entry = ToastManager.Add("Uploading…");
    entry.Update("Upload complete", NotificationStyle.Positive);

    Fields

    defaultLimit

    The default stack depth.

    Declaration
    public const int defaultLimit = 3
    Field Value
    Type Description
    int

    Properties

    limit

    How many toasts stack at once. Clamped to at least 1. Lowering it trims the stack immediately, dropping the oldest entries.

    Declaration
    public static int limit { get; set; }
    Property Value
    Type Description
    int

    toasts

    The live stack, newest first. Never null.

    Declaration
    public static IReadOnlyList<ToastEntry> toasts { get; }
    Property Value
    Type Description
    IReadOnlyList<ToastEntry>

    Methods

    Add(string, NotificationStyle, string)

    Post a new toast at the top of the stack.

    Declaration
    public static ToastEntry Add(string text, NotificationStyle style = NotificationStyle.Default, string icon = null)
    Parameters
    Type Name Description
    string text

    The raw message, or a Localization dictionary key.

    NotificationStyle style

    The semantic style of the toast.

    string icon

    An optional leading icon name.

    Returns
    Type Description
    ToastEntry

    The entry, so it can be updated or dismissed later.

    Clear()

    Remove every toast immediately. Gives imperative flows — and tests sharing this global store — a way to start from an empty stack.

    Declaration
    public static void Clear()

    Dismiss(int)

    Remove the entry with the given id. Unknown ids are ignored.

    Declaration
    public static void Dismiss(int id)
    Parameters
    Type Name Description
    int id

    The identifier of the entry to remove.

    Dismiss(ToastEntry)

    Remove an entry from the stack. Unknown or already-removed entries are ignored.

    Declaration
    public static void Dismiss(ToastEntry entry)
    Parameters
    Type Name Description
    ToastEntry entry

    The entry to remove.

    Events

    changed

    Raised whenever the stack changes: an entry added, updated, dismissed or cleared.

    Declaration
    public static event Action changed
    Event Type
    Type Description
    Action
    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)