chat on collision c#

Can anyone guide me in the direction of a script that prompts the user in a chat dialogue once they collide with the object. I know its possible but i cant get mine too work

For example like this:

ArrayList Chat = new ArrayList();

void OnCollisionEnter(Collision collision) 
{
    Chat.add("You hit "+collision.collider.name);
}

void OnGUI()
{
    int i = 1;
    int top = 110;
    int height = 100;
    foreach(string S in Chat)
    {
       Rect TextRect = new Rect(10,i*top,Screen.width-10,height);
       GUI.Label(TextRect,S);
       i++;
    }

}