Notification

Notification is used to display a fading text and icon message.

The following script shows, how you can use the Notification widget.

using UnityEngine;
using UnityEngine.UI;
using System.Collections;
//Import Namespace
using DevionGames.UIWidgets;

/// <summary>
/// Notification example.
/// </summary>
public class NotificationTrigger : MonoBehaviour {
    //Reference to the Notification widget in scene
    private Notification m_Notification;
    //Options to display containing information about text, icon, fading duration...
    public NotificationOptions[] options;

    private void Start(){
        //Find the reference to the Notification widget
        this.m_Notification = WidgetUtility.Find<Notification> ("Notification");
    }

    /// <summary>
    /// Called from a button OnClick event in the example
    /// </summary>
    public void AddRandomNotification(){
        //Get a random NotificationOption from the array
        NotificationOptions option=options[Random.Range(0,options.Length)];
        //Add the message
        m_Notification.AddItem(option);
    }

    /// <summary>
    /// Called from a button OnClick event in the example
    /// </summary>
    public void AddNotification(InputField input){
        //Add a text message
        m_Notification.AddItem (input.text);
    }

    /// <summary>
    /// Called from a Slider OnValueChanged event in the example
    /// </summary>
    public void AddNotification(float index){
        //Round the index to int and get the option from options array.
        NotificationOptions option = options [Mathf.RoundToInt (index)];
        //Add the message
        m_Notification.AddItem (option);
    }
}