What are the recommended ways of putting the NPC’s name over their head?
I tried a GUI.Label but that doesn’t work as the Text over the head should scale with distance, ie, the further away you are, the smaller the text should be.
I have searched the forums and haven’t found a good a way to do this. Do I have to change fonts based on the distance from the camera?
You might also be able to use a TextMesh to display the names. TextMeshes are objects in 3D space, so they can be placed above the character and will scale as appropriate.
If your not doing to much stuff with it and you want to use the LookAt script, I’d suggest scaling the text mesh in negative X and Z. Had the same problem myself but this fixed it right away, and the selecting of the mesh wasn’t affected either.
To the windows users who had trouble downloading the zip, my apologies. I just reloaded the file- I dont know if its any good but if anyone feels like checking that would be great. Its about 3mb
I use this, if you want you can’t remove the “public” from Camera.
using UnityEngine;
using System.Collections;
public class NombrePersonaje : MonoBehaviour {
public string Nombre;
public Camera cam;
TextMesh texto;
// Use this for initialization
void Start () {
cam = Camera.main;
texto = GameObject.Find("Nombre_Char").GetComponent<TextMesh>();
texto.text = "<"+Nombre+">";
}
// Update is called once per frame
void Update () {
if (cam != null) {
transform.LookAt (cam.transform);
}else
{
cam = Camera.main;
}
}
}