Message Displayer

Hi,

I have question about this:

http://www.unifycommunity.com/wiki/index.php?title=MessageDisplayer

using UnityEngine;
using System.Collections;

// Use this script on a guiText object to have status messages
// Just call messageDisplayerObject.DisplayMessage("hello") and you'll
// get a line of self disappearing messages.

public class MessageDisplayer : MonoBehaviour
{
    ArrayList messages = new ArrayList();

    public void DisplayMessage(string message)
    {
        messages.Add(message);
        UpdateDisplay();
        Invoke("DeleteOldestMessage", 5F);
    }

    void DeleteOldestMessage()
    {
        // The following "if statement" protects this function from
        // getting called by SendMessage from another script and
        // crashing.
        if (messages.Count > 0)
        {
            messages.RemoveAt(0);
            UpdateDisplay();
        }
    }

    void UpdateDisplay()
    {
        string formattedMessages = "";

        foreach (string message in messages)
        {
            formattedMessages += message + "
";
        }

        guiText.text = formattedMessages;
    }
}

If I would like to use messageDisplayerObject.DisplayMessage("hello"), do I have to create an object of MessageDisplayer? If so how can I do that?

Thank you very much.

You need to attach this script to a GUIText object. Then, you can make a call to nameOfYourGUITextObject.DisplayMessage in any script which has a reference to your GUIText object in order to display a message.