how to appearing a text when player reach at one checkpoint

hi there…
im very newbiest in using unity.
right now im working with unity to create one educational game.
im trying to make a text dialog for my game once player reach or meet an other character/checkpoint. while the dialog appear, the game scene will pause/freeze for a while.

i need an ideas how to make this scene success. any suggestions would be appreciated. TQ

First off, welcome to the forums!

Second, here are some pointers to get you going:

  1. You should look into using our physics features, notably rigid bodies, colliders and triggers. You’ll be able to set up a trigger at your checkpoint and fire off an event when the player (using a character controller) enters the trigger (your checkpoint).

Start simple, have that function just drop a message into the status bar of Unity using Debug.Log() or something comparably simple. When done, move on to #2

  1. When the user hits that trigger point you can display whatever GUI elements you want, you should start simple and look at the GUI class and GUI.Label in particular. It allows you to show a simple block of text or an image.

Again, start simple, hit the checkpoint and show a basic message “You arrived!”. Once you’re done with that then you can explore the GUI class a lot more and craft a nice GUI window, or group to make your message look nicer.

Oh, and have fun while doing it! :slight_smile:

Hi again…

Thanks HiggyB for your suggestion. its very useful. now my GUI dialog was works fine.
One more thing need to ask you is, how im gonna pausing the player while the gui text displayed?

My GUI function as a stated below. while the GUI displayed time by time, i wanted to make Player pausing and once the display GUI done/finish the Player will continue playing until meet for the next checkpoint. please help me in this situation. Thanks in advanced :wink:

if (showGUI)
{
//Debug.Break();
if (Time.time - 1 < 2)
{
GUILayout.Box (“Farah: I will be in radio contact with you while you are on the islands.”);
}
else if (Time.time - 1 < 4)
{
GUILayout.Box (“Player: ROGER THAT!”);
}
else if(Time.time - 1 < 8)
{
GUILayout.Box (“Farah: Pls wait until you meet another checkpoint”);
}
}

You can set Time.timeScale to zero and/or use variables, messaging or function calls to trigger a “paused” state in various objects.

Keep in mind that Time.time returns the time elapsed (milliseconds) since the game started. Based on your code, “Farah”'s first line could only possibly appear during the first 3.0 seconds after the game was launched. :stuck_out_tongue: Trap the value when you pause the game, then each frame after compare that the value that frame against the initially trapped value.

Instead of that you might consider co-routines as they’re really quite useful for this sort of thing. Here’s a basic example:

// Untested forum code
var dialogText = "";
var showGUI = false;

function OnTriggerEnter () {
  Time.timeScale = 0.0;
  ShowConversation();
}

function OnGUI () {
  if (showGUI) {
    GUILayout.Box(dialogText);
  }
}

function ShowConversation () {
  showGUI = true;
  dialogText = "Farah: I will be in radio contact with you while you are on the islands.";
  yield WaitForSeconds(2.0);
  dialogText = "Player: ROGER THAT!";
  yield WaitForSeconds(1.0);
  dialogText = "Farah: Pls wait until you meet another checkpoint";
  yield WaitForSeconds(1.5);
  showGUI = false;
  dialogText = "";
}

Doing dialog displays is a big topic as there are many ways to slice it. My example above is something that’s basic and untested, but hopefully enough to get you going.