- Home /
How to display text on a gamebject?
Hi, I am quite new to unity.
In my game I have to display some text on a gameobject. Currently I am just trying to get it to work, but I can't. Let's say I want to display a single letter on a series of cubes/squares. How can I do this? I have tried creating a prefab "square" and added a default cube to it. Then I tried to add a component GUIText, which did nothing as well as a text mesh which also did nothing.
How can I display text on my gameobjects?
Answer by twonty · Aug 06, 2011 at 04:09 PM
You could make a new object in a 3D image creator and place text on that and place it on the object. I am probably wrong for I am a noob with Unity.
Answer by KrisCadle · Aug 23, 2011 at 10:58 PM
Hey, check out this cool and easy to use GUI Object Label Script... I've used it and it's actually pretty useful...
http://www.unifycommunity.com/wiki/index.php?title=ObjectLabel
Thank you very much for the link! :D In order to keep it up to date, I changed the "[RequireComponent (typeof (GUIText))]" to "[RequireComponent (typeof (Text))]" and added "using UnityEngine.UI", else it was just to add a UI "Text" object and add the script to it ins$$anonymous$$d of a "GUIText" object and add the script on it.
Answer by JUnityer · Aug 06, 2011 at 06:17 PM
This depends on what purpose you want it for. You could just simply make a normal cube, and a 3D text. Move the text so that it is positioned in front of the cube the way you want it. Then make the text a child object of the cube by dragging it inside the cube (in the hierarchy panel).
Another way would be just to create a texture for the cube which has text in it :)
So, if this won't help please specify what are you going to use it for! (2D? 3D? Is it stationary or is it supposed to move?)
Your answer
![](https://koobas.hobune.stream/wayback/20220612171750im_/https://answers.unity.com/themes/thub/images/avi.jpg)