Text on GameObject without UI

Hello,

I have a game where I want to instantiate a group of gameobjects with a random numeric value on each one. This is like a small challenge where the objects fall from above and the player has to only collect the correct object.

I have no issue instantiating the gameobjects and making them fall, but I am struggling with how to get the numeric text written on the objects?

I have tried by creating a canvas as a child object, but that doesn’t seem to work. Does anyone have any ideas about how to do this?

Many Thanks,

J

That’s gonna be the way to do it in 2021.

Another way to do it is something like what I have attached here:

It uses the legacy TextMesh but you could easily update it to use TextMeshPRO (non-UI)

7207900–865858–Digits1.unitypackage (5.7 KB)

Hi,

Thank you for your response. How do you get the canvas to be on the game object? So it looks like it is written on it? The gameobject is only about 30px wide but it seems like the text cannot go small enough and its just blurry.

Many Thanks,

J

Raise the font size until it is large enough to be clear, scale the size of the canvas down at the transform level. I usually scale my world space canvases to 0.01