- Home /
How do I add a text to Game Object and follow it in the scene?
Hi
I would like to make a Text that follow a game object in the scene. For example, add a Character name on top of character and follow the position of the character.
I have tried GUIText and set its parent transform to a GameObject. However They are not moving in the same scale. I also tried attach GUI Text as component to the GameObject. Same thing happen as above, they are not moving at right scale. (GUIText always moves faster than the GameObject)
Could anyone give me a hand? The text I would like to assign are dynamic, i.e. Could not be preset before runtime.
Thanks.
Answer by Meater6 · Aug 23, 2011 at 04:20 AM
Try this using ScreenToViewPort, that should do it. Make sure to convert from pixels to relative screen size, though.
Thank you. I used WorldToScreenPoint and follow Joshua example to allow my GUI.window (any everything inside) follow the GameObject. Thank you very much.
Answer by catiaAf · Aug 03, 2012 at 11:29 PM
Please can anyone help me... i have the same problem but i cant see the example... thanks :))
Your answer
![](https://koobas.hobune.stream/wayback/20220612190429im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Transform on GUIText not working? 3 Answers
guiText/GameObject position 2 Answers
How to set the position of a guitext using transform? 1 Answer
Raycast Hit Not Working (JS) 2 Answers
Transform override 3 Answers