Skip to content

SiroccoToast Reference

SiroccoToast is a lightweight, easy-to-use toast notification system designed for Unity UI, included as a third-party asset within RaceTiming. It provides a built-in pre-warmed pool and supports queuing logic for notifications.

While RaceToastBridge acts as the connector for race timing events, these are the core components of the toast system itself.

Core Components

The SiroccoToast system consists of two main runtime components:

1. ToastManager

The central component responsible for: - Instantiating toast prefabs. - Ensuring a Canvas exists to render toasts (creates one automatically if missing). - Positioning them on screen without overlap. - Managing the stack of multiple toasts. - Auto-dismissing toasts after a given duration.

Key Inspector Fields: - Toast Prefab: The prefab used for each notification (must contain a ToastView). - Position: Where the toast stack appears (e.g., TopRight, BottomCenter). - Default Duration: Seconds before auto-dismiss if not overridden. - Newest On Top: Controls whether new toasts appear at the top or bottom of the stack. - Pause On Hover: If enabled, the auto-dismiss countdown pauses while the user hovers over a toast.

API Usage:

// Show a toast with a message, optional icon, and optional custom duration
SiroccoToast.ToastManager.Instance.Show("New Lap Time!", mySprite, 3.5f);

2. ToastView

The component attached to the individual toast prefab. It handles: - Binding the message text and optional icon. - Controlling fade-in and fade-out animations via a CanvasGroup. - Publishing events for dismiss requests and pointer hover changes.

Prefab Requirements: Your toast prefab must have: - A ToastView component. - A CanvasGroup component (required for fading). - (Optional) A Text element for the message. - (Optional) An Image element for the icon. - (Optional) A Button element for manual dismissal.

Default Prefabs

SiroccoToast includes ready-to-use prefabs located at: - Assets/SlowToastRacing/RaceTiming/ThirdParty/SiroccoToast/Prefabs/ToastManager.prefab - Assets/SlowToastRacing/RaceTiming/ThirdParty/SiroccoToast/Prefabs/DefaultToast.prefab

You can use these directly or duplicate and customize them to match your game's UI style.