Damage Text pop-up when enemy is hit
Hey everyone,
I've encountered another problem. This time it's not an error or anything like that though, I just don't know how something works.
So yesterday I wasted half my day trying to figure out how to get a damage pop-up above an enemy's head when he takes damage. I've tried several things, none of which functional. So now I'm trying my luck here.
What I want is a text appearing above an enemy for a few seconds, this text being the damage it took (which I can easily fetch with a GetComponent). I don't want the text to follow the enemy, I want it to stay at the position it was created at, even if the enemy moves to another position.
I wish I had any code to present you guys with, but I don't know where to start. I tried doing something with a canvas on worldspace, but I had no luck with this. The canvas didnt even show any text at all, not even if I typed it into the child-textobject manually.
Anyway, I hope I can get some help with this, it'd make my day. If there is any more information I have to give, please do tell me, I will provide any necessary info and code.
Thanks for your time! Bart
UI Text is a little tricky when you put it into a WorldSpace Canvas. You've got to play around with the Canvas Scaler values so that the text doesn't render over pixelated.
There are so many ways to do what you want, it's hard to tell you how. It's a matter of architecture. You could transform the enemy transform from world space to screen space, then position a UI.Text in screen space for example.
Answer by goutham12 · Dec 21, 2016 at 12:10 PM
might be scaling issue. do like
create a canvas.
initially canvas size was very large. so reduce it to your requirement.
and add text to that canvas and re scale it.
still your text is not visible. then it was font issue.
that time increase the font size and check.