- Home /
 
               Question by 
               Xeromex · Oct 30, 2014 at 03:23 PM · 
                gameobjecttextguitexttextfield  
              
 
              Add text on top of a gameobject. What is the best way?
Okay, so I'm making a 'Piano Tiles' game where you learn the tables. I've finally made a working movement using transform.Translate. Now I want a random number generated on top of the tiles (each tile has it's own gameobject). I tried GUIText component but it's generated really weird and it's moving like four times as fast as the normal tiles.
Is there any other way to add a simple piece of text on a gameobject which also needs to move with the same speed as the gameobject.
Thanks.
               Comment
              
 
               
              You can make a Text$$anonymous$$esh that is child object of your game object
Answer by robertbu · Oct 30, 2014 at 03:25 PM
You can use 3D Text/Text Mesh, or you can not parent your GUIText and instead have it follow an a game object.
 var toFollow : Transform;
 
 function Update() {
      transform.position = Camera.main.WorldToViewportPoint(toFollow.position);
 }
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                