- Home /
Display UI Text on a 2D Sprite
Hello!
I'm having trouble displaying a UI Text element on an existing 2D Sprite. I have seen several similar questions but none seem to address the exact problem.
I need the text on top of the sprite image so I can display a value dynamically. The game is question is a card game, so I want the power displayed dynamically over the sprite of the card.
Is there any way I can do this, either through code or the Editor?
Thanks in advance and happy programming!
Answer by Mischa · Jul 07, 2015 at 09:06 PM
You could use a Canvas in world space mode and then set up the sprite as an UI image component with the text as a child of it.
Documentation for UI Canvases is found here:
But that only makes it visible ontop of one sprite. What if it needed to be visible ontop of many sprites?
Your answer
Follow this Question
Related Questions
Sprites and text 1 Answer
Basic: Text sub-component of sprite prefab not showing 0 Answers
Pixel Perfect Text 1 Answer
Make TextMeshPro text appear over sprite? 1 Answer
how to render a sprite font with new native 2d commands? 0 Answers