How to create a GUI Text when reaching a point

Hello everyone, i’m currently working on a horror game and i’ve being searching for an idea everywhere, such as: Google, Youtube, Unity Answers etc…

Here’s my idea: How to create a GUI text when reaching a place.

What I actually mean is not an object, I mean the position (for ex: X:534, Y:311, Z: 734)

If you guys have any kind of script that are vaild for my idea OR if you find a link that sounds familiar to this post, please post them below, I would apreciate anything (that works, of course)

Thanks!

~crusherxman

There’s lots of ways of doing this, and what you want will depend on your game. Here is a starter script. Attach it to an object (even an empty game object). It assumes the trigger object is named “Player”. ‘distance’ is near the trigger object needs to be before a message is displayed.

var distance : float = 0.3;
private var goPlayer : GameObject;

function Start() {
  goPlayer = GameObject.Find("Player");
}

function OnGUI() {
	if ((goPlayer.transform.position - transform.position).magnitude < distance)
		GUI.Label(Rect(50,50, 300, 50), "Some Text");
}