How do you add text to a sprite?

Hi, I am trying to make a simple 2d box sprite that has a text on it. I’ve tried to create a rectangle sprite and add text component, but it doesn’t work.

What I am trying to make is something like 68961-12.png

but I want the text to be changeable. Also, it’s not going to be a UI button so I do not want to add canvas.

How do you simply make a sprite like this?

Text components have to do with the new Unity UI implemented in Unity 4.6. If you make a 2D sprite, it is an object, not really a UI element. The only other component know of that is ‘scene place-able’ would be a Text Mesh. Basically the text alternative to a sprite. So just create an empty game object, child it under you box sprite, and add that component.

If what you are making, is in the scene as an object, I would continue with what you are doing. But if you are making a UI element, like a button, I would suggest using the canvas system. It has a lot more functionality, and there are a plethora of tutorials. But it is just a suggestion.

Good luck with everything, and I hope this solves you issue.

~Matt

This worked for me:
Select Canvas : Set “Render Mode” to “World Space”

Note - Remember to set both X and Y to 0 for both Canvas and Text Positions. If you still face issues, try setting the Camera option below Render Mode(just drag & drop - Main Camera) & reduce Scale of Rect Transform to 0.1 or less.