How to set On Screen Message w/ timer

I have a puzzle game where the player wanders this endless puzzle, and after a certain period of time, I want a message to pop up saying there is no end, and then the game ends. I am new to Unity and would like some assistance in setting this up, so any tutorials/scripts/hints would be very helpful, thanks!

Just use Invoke:

var timeToWait = 120.0;

function Start () {
    Invoke("GameOver", timeToWait);
}

function GameOver () {
    // do whatever here
}

here's what i use to post time... you could use that to show a timer. right now, the time is always showing.... and you might want to change the hours, seconds, and minutes yourself, and maybe change the values in the script yourself. but i'll provide the message thing.

var showGUI = false;
    var Timer : int = 0;
    var seconds : int = 0;
    var CTRL : int = -100;
    var minutes : int = 0;
    var hours : int = 0;
    var CTimer : int = 0;
    function Update()
    {
     CTimer++;
     Timer--;
     if(Timer == CTRL)
     {
      seconds --;
      Timer = 0;
     }
     if(seconds == -60)
     {
      minutes --;
      seconds = 0;
     }
     if(minutes == -60)
     {
      hours --;
      minutes = 0;
     }
     if(hours == -25)
     {
      hours = 1;
     }
     if(CTimer == -500)//at about 5 seconds, do something.
     {
      //print GUI as in turn a showGUI boolean to true.
      showGUI = true;
     }
}

    //GUI function to print the time the player spent playing
    function OnGUI()
    {
     if(showGUI)
     {
      GUILayout.Button("there is no end!");
     }
     GUI.Label(Rect(20,100, 400,30), "Time past: " +hours * -1+":"+minutes * -1+":"+seconds * -1);
    }

I think this C# script should do what you're looking for. It waits 60 seconds, then pops up a big button over the screen. Once button is pressed, the application exits.

It only exits if it is a built executable.

using UnityEngine;
using System.Collections;

public class ExitTimer : MonoBehaviour
{
    public string message = "There is no end...";
    private bool pressedOk = false;
    private bool showGui = false;

    private IEnumerator Start ( )
    {
        // Wait one minute.
        yield return new WaitForSeconds( 60.0f );

        // Wait for button press.
        yield return StartCoroutine( WaitForOkButton( ) );

        // Quit application (doesn't work in Editor I think).
        Application.Quit( );
    }

    private IEnumerator WaitForOkButton ( )
    {
        // Show gui
        showGui = true;

        // Wait for Gui
        pressedOk = false;
        while ( !pressedOk )
            yield return null;

        // Hide gui
        showGui = false;
    }

    private void OnGUI ( )
    {
        if ( showGui )
        {
            Rect fullScreen = new Rect( 0, 0, Screen.width, Screen.height );
            if ( GUI.Button( fullScreen, message ) )
            {
                pressedOk = true;
            }
        }
    }
}

This example makes use of Co-routines. It allows your logic to pause its execution in place, without actually stalling the rest of the program. I suggest you learn about co-routines as they are really nice when working with scripts that require sequential action like the one you described (any waiting actions, basically).

To use this, just place the script on any game object (that isn't deleted, or the timer stops). You need to match the file name with the class name (unless they changed that since 2.6 era), so you should put this code in a new file called ExitTimer.cs.