Toast Notification Message

FREE
Publisher Conrado Saud
File size 283.31kB
Number of files 13
Latest version 1
Latest release date 2024-04-08 04:45:11
First release date 2024-04-08 04:45:11
Supported Unity versions 2018.4.2 or higher

🚀 Toast Notification Message plugin for Unity 🚀


The Toast Notification Message is a Unity plugin that provides a simple and effective way to display toast-style messages in your game. With this plugin, developers can easily show short and informative messages anywhere on the screen. Messages can be customized with text, icons, and more!


Key Features:

  • 📝 Customize messages with text and icons.
  • ⏰ Set message duration or allow indefinite display.
  • 🖱️ Pause timer on mouse hover.
  • ✨ Hide messages with a simple click (including via code).

With a user-friendly interface and flexible customization options, the Toast Notification Message is perfect for providing instant feedback, communicating important information, or simply adding a touch of interactivity to your game.


📚 User Guide —

👨‍💻 How to Use This Plugin in Your Project:


🎬 Check the video tutorial: click here.

  1. In your project, create an empty object in the hierarchy, within a Canvas. This object can have any name, but a suggestion is to name it "ToastNotificationMessage". Add the CanvasGroup component to it so that the Fade effect can occur.
  2. Add the C# script ToastNotification.cs to the new ToastNotificationMessage object.
  3. The script requires the prefab of the message that will be displayed on the screen. In the root folder of this plugin, there are two prefabs (DefaultMessageModel[and Small]). Choose one of the two and drag it into the "Message Prefab" field of the script.
  4. In the ToastNotification script, you can configure how you want the messages to be displayed by default in your game.
  5. To display a message on the screen, simply call the Show function within ToastNotification anywhere in your code. See bellow.

⭐ Examples:


Simple message:

ToastNotification.Show( "Hello, world!" );


With icon:

ToastNotification.Show( "Hello, world", "info" );


Custom time:

ToastNotification.Show( "Hello, world", 6.5f );


Complete message with time and icon:

ToastNotification.Show( "Hello, world", 5f, "error" );



🚦 Dependencies:


This asset has a dependency on TextMeshProUGUI installed to work (version 2 or higher [recommended version 3 or higher])

🔴 Attention: if the letters are still not appearing, you need to update the version of your TextMeshProUGUI. 

Access the Window menu > Package Manager > Select Packages: Unity Registry (top left menu) > Search for TextMeshProUGUI > Click Update to [latest version] (top left corner)


🌠 Utilities:


  • Available icon names: success, error, alert, info.
  • You can add your own icon by opening the prefab you're using and adding it as a child object of the Icons object.
  • If you show a message passing zero as the time value, the message will be infinite on the screen until dismissed. Example: ToastNotification.Show( "Hello, world", 0 );
  • You can close/dismiss any message on the screen using the command ToastNotification.Hide();
  • To create your own message prefab, duplicate one of the existing prefabs and make your changes. It's recommended to only change the background color, screen size, and message size. Anything else may not be compatible with the script that handles messages on the screen. Also, always keep the position, pivot, and anchor set to zero.
  • Remember to properly organize the hierarchy of your Canvas so that messages can overlay all elements on your screen, if desired.

For additional details and more usage tips, read Technical Details section bellow.

Top Publisher Assets