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?

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)

https://docs.unity3d.com/Manual/HOWTO-UIWorldSpace.html

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.

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);