- Home /
HUD - text following game object
Hi
I would like to make a HUD - text that follows a game object in the scene. I used the following script as a base: Objectlabel src. If I set the Text to HUD - Layer, logically the text won't move on the screen as long as the object won't move. My problem: The same happens if I change the camera rotation. How do I "compensate" the cameras rotation?
Answer by TheVectorHunter · Aug 15, 2012 at 04:10 PM
If you are trying to say that the label won't stay at a rotation parallel to the camera then you need to put Transform.LookAt(myCam); so the text is always rotating towards the camera.
If I answered your question please vote up my answer and accept it.
Thank you for your answer and sorry for the delay. I had problems with the login and the new account, then I was out of office. I was looking for a solution where a (2D) GUI-Label (or TextField) follows a 3D object.
I added a textmesh to the object. It looks nice like this and works fine (also with Unity 4 Beta and dynamic fonts!)
Your answer
![](https://koobas.hobune.stream/wayback/20220613075711im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Display a Text/GUI on screen when triggerd with Fadein/Fadeout 1 Answer
Odd question... can a GUIText object be displayed upside-down? 2 Answers
How to display health on screen as text? 1 Answer
Maintaining Image Aspect Ratios in GUI using Matrix? 1 Answer
How can I add "..." to GUI.Label if it goes past its bounds? 1 Answer