npc text box

hi guys my name is cakegamer and im makeing a game for fbla and i need to put in a npc chat box like this


but will also alow me to make it a event so wen a player going in to a set plase it will pop up with text
i have ben looking but i cant find a totreal so can you guys help me ples and thank you

I strongly recommend following the Unity tutorials. They’ll show you what you need to know.

That said, here are some tips:

For going to a set place, add a trigger collider and a script that implements OnTriggerEnter() (or OnTriggerEnter2D() for 2D games). When the player enters the trigger, show the text.

There are many ways you can show text. Here’s one method, which isn’t necessarily the best, but the code is short and it demonstrates OnTriggerEnter(). Add a GUITexture to your trigger. Set it up to look the way you want, then disable it. When the player enters the trigger, enable it. For example, add a script like this to your trigger collider GameObject:

uses UnityEngine;

public class TextboxTrigger : MonoBehaviour {

    public GUITexture textbox; // <-- Assign your GUITexture to this.

    void OnTriggerEnter(Collider other) {
        textbox.enabled = true;
    }

    void OnTriggerExit(Collider other) {
        textbox.disabled = false;
    }
}