- Home /
Putting text on a 3D object?
In my scene I have a table that Instantiates a bunch of pieces of paper (thin cube objects) and I wanted to put randomly generated text on the paper... The problem is when I looked up how to do it, people said to put a Text Mesh on the object, but it doesn't work. A popup says "Can't add component 'TextMesh' to Paper because it conflicts with the existing 'MeshFilter' derived component!"... Any help?
Try making a sprite with the text on then adding it to the whole cube
You'd have to create a new object as a child if you were going to do that.
Answer by Jacky-Marley · Dec 01, 2016 at 10:08 AM
or you can add another canvas on World space render mode, you give it the size of your paper and you can add UI stuff on it (I currently do it with a computer 3D model)
Answer by codemaker2015 · Oct 19, 2020 at 05:45 AM
You can do that with a UI Text game object and the 3D Object.
The steps are as follows:
In your empty scene, create a 3D Cube.
Create a UI Text object.
Drag the Canvas to become a child of the cube.
Set the Canvas to World Space render mode, remove the Canvas Scaler component and set Width = Height = 1 and all Pos = 0.
Set the text Width = Height = 100, all Scale = 0.01 and Pos Z = -0.5.
This does not work for me.. The text is just floating around, could you help me out?
Answer by BeRee · Nov 30, 2016 at 10:41 PM
Also had this Problem. Add a Script. There you can make a new GameObject and assign a TextMesh.
GameObject text = new GameObject();
TextMesh t = text.AddComponent<TextMesh>();
t.text = "new text set";
t.fontSize = 30;
Than you can position that Text like that.
t.transform.localEulerAngles += new Vector3(90, 0, 0);
t.transform.localPosition += new Vector3(56f, 3f, 40f);
Similarly, you could also user Unity's UI text. This usually gives more aesthetically pleasing results.