Unity 3D Simple Pop Up Text Tutorial
DIRECT DOWNLOAD HERE
THIS IS BACKUP IN TEXT FORM
1. Create New java and name it : PopUpText
2. Copy & Past this text and save java :
---------------------------------------------------------------------------------
//----------------------------------------------------------------------------------
// POP UP TEXT//----------------------------------------------------------------------------------
#pragma strict
var player: Transform;
var showOnDistance: float = 2;
private var textMesh: MeshRenderer;
//----------------------------------------------------------------------------------
function Start ()
{
textMesh = gameObject.GetComponent(MeshRenderer);
}
//----------------------------------------------------------------------------------
function Update ()
{
if (Vector3.Distance(transform.position, player.position) < showOnDistance)
textMesh.enabled = true;
else
textMesh.enabled = false;
}
//----------------------------------------------------------------------------------
---------------------------------------------------------------------------------
0 comments:
Post a Comment